Why is my custom email notification after purchase not sending?

Check if the email is not going to spam or junk folder. Sometimes, emails from automated systems can be classified as spam by email providers.

Make sure that the email address ‘[email protected]’ is correct and working.

Verify that the four product IDs in the $targeted_ids array are correct and match the IDs of the products you want to trigger the email.

Make sure that the code is executing by adding some debug statements like “echo ‘Code is executing’;” at the start of the function to see if it’s being executed.

Check if the email sending functionality is working on the website by trying to send a test email using a plugin like WP Mail SMTP.

Finally, you can also try using a different email address for the recipient to check if the issue is specific to the email address ‘[email protected]’.