WordPress – Email not sending after Jetpack Update

I recently ran into an issue where I updated the Jetpack wordpress plugin to version 9.2, and suddenly the contact forms stopped working.  I was able to see the form submit completely, and the contact information was still available in the “feedback” tab in the wordpress dashboard, but the actual email sending wasn’t working.

Fortunately, I have a solution..

I went through a series of troubleshooting for wordpress email, and confirmed that all other wordpress generated emails were sending just fine. The only issue was with the Jetpack contact form.

After doing some digging, I discovered that it was in the way that the headers were being formed in the latest jetpack update.  I tried working with the jetpack plugin support team, as I was not the only person with the issue….  and they said they were working on a fix.. though it’s been over 2 weeks now, and they just launched an update without the fix!

Flywheel, the wordpress dedicated hosting company I use for many of my clients sites, came through for me.  I had anticipated it might be an issue with their servers, but they confirmed that it was not on their end, and that it was in fact an issue with Jetpack.  However, Flywheel went above and beyond in troubleshooting the issue, and even gave me a patch that I could use.

Just copy and past this to the end of your theme’s functions.php file, and everything should work out great!

add_filter('wp_mail', 'fw_mail_settings');
function fw_mail_settings( $args ) {
 foreach( $args['to'] as $k => $to ) {
 $to = str_replace('"', '', $to);
 $to = explode(" ", $to);
 $to = $to[0];
 $args['to'][$k] = $to;
 }
 return $args;
}