Emails not being received from WordPress

I have a client with a WordPress installation on GoDaddy. I installed Formidable Forms for their registration process. Problem was, about 75% of their users were not getting their registration emails.

After troubleshooting with GoDaddy and Formidable for months we finally found a solution. I’m posting this, because I’ve seen many other webmasters post about same problem.

Problem: We finally determined that the email headers were incorrect and therefore some mail servers were rejecting the messages. It all depends on how the ISPs set up their email and how sensitive their spam filters are.

Solution: Make sure all FROM headers are from a real email address and that they match:

1. Set outgoing emails in Formidable (or other Contact Form Plugin) to have be FROM: email@yoursite.com

2. Edit your theme’s functions.php or custom-functions.php and add a code snippet to make sure all WordPress emails come from email@yoursite.com:

<?php
add_filter('wp_mail_from', 'set_default_from_email');
 function set_default_from_email($email){
    $email = 'email@yoursite.com';
    return $email;
 }
add_filter('wp_mail_from_name', 'set_default_name');
  function set_default_name($name){ 
    $name = 'Name You Want';
    return $name;
  }
?>

3. Install this plugin.

Copy the code below and put it in a new file, named email_return_path.php and add it to the wp-content/plugins/ folder. Don’t forget to log in into WordPress admin and activate the plugin!

/*
Plugin Name: Email Return Path Fix
Author: Abdussamad Abdurrazzaq
*/
<?php
class email_return_path {
   function __construct() {
        add_action( 'phpmailer_init', array( $this, 'fix' ) );   
   }
   function fix( $phpmailer ) {
        $phpmailer->Sender = $phpmailer->From;
   }
}
new email_return_path();
?>

If you ever want to change the FROM: email, please edit all three of those. And make sure it’s a real email address so the email servers can ping it. And don’t forget if you change the theme, you’ll have to do #2 again!

Hope this helps you…let me know.

Jennifer

Similar Posts