How to send an email using wp_mail and using more than one BCC in the header

I have this code part that’s responsible for getting the variables from the contact form – and and sending an email to me, and my friends from work. add_action(‘wp_ajax_nopriv_submit_contact_form’, ‘submit_contact_form’); // Send information from the contact form function submit_contact_form(){ // If there is a $_POST[’email’]… if( isset($_POST[’email’]) && ($_POST[‘validation’] == true ) ) { $email … Read more

Do something after sending email

I want to do something after WordPress sent an email. For example, after sending “Reset Password” email using wp_mail() function. 1 1 Using the PHPMailer class with an action callback: I did some digging into the PHPMailer class and found that it supports a custom action. Here’s how the callback is activated with the doCallback() … Read more

What is the advantage of using wp_mail?

What is the advantage of using wp_mail() over mail(). Codex says they’re similar, but they seem to be very similar. 1 wp_mail() is a pluggable function: It can be replaced by plugins. That’s useful in cases where the regular mail() doesn’t work (good enough), for example when you need extra authentication details. Example: WP Mail … Read more

Why won’t wp_mail() let me set the From: header when plain old PHP mail() will?

When I use wp_mail( $to, $subject, $message, $headers ) (with values in place, of course), the email gets sent with a from name and email that isn’t set anywhere I can find (not even in PHP or Apache settings). However, using mail( $to, $subject, $message, $headers ) instead works just fine. What could be happening … Read more

Sending multipart (text/html) emails via wp_mail() will likely get your domain banned

Summary Because of a bug in WP Core, sending multipart emails (html/text) with wp_mail() (to reduce chance of emails ending up in spam folders) will ironically result with your domain being blocked by Hotmail (and other Microsoft emails). This is a complex problem that I’ll aim to break down in great detail in an attempt … Read more