Everything was working great until I updated WP to 4.2.2. The SendGrid plugin was failing silently. No error messages. My client lost about 15 quote-request leads the afternoon I upgraded WP. It was urgent to find a solution that worked immediately. I was hoping for a quick reply. 3 weeks to reply makes it look like support is an afterthought.
It appears a function was removed from WP. I had to add this missing function to change the email into an HTML email.
function set_html_content_type( $content_type ) {
return “text/html”;
}
Then after I clean the inputs for spam and hacking activity, I send the email:
add_filter(‘wp_mail_content_type’, ‘set_html_content_type’);
wp_mail( $sendto, $subject, $message, $headers );
remove_filter(‘wp_mail_content_type’, ‘set_html_content_type’);
My understanding is that SendGrid plugin takes control of sending emails from the wp_mail() function. It does’t really matter what code comes before or after wp_mail(), SendGrid is going to send the email instead of the website, and that’s what I want.
But still, with the missing function added in, SendGrid didn’t work. No matter what I tried, I could not get SendGrid to work again. I probably spent 12 hours identifying the problem and trying to get it working again. I deactivated SendGrid plugin and installed and activated the MailChimp for WordPress plugin and it worked perfectly.
Also, I could see my emails (from the quote request form) going through SendGrid. They were listed in the log of emails sent, but I would never receive any email. I tested a bunch of different email addresses and checked the spam folder and they never arrived. I was nowhere near the daily limit of emails sent. Then I would send a test email from the SendGrid setting page inside WP admin and I would get the test email immediately. Totally weird. Makes no sense.
I’m going to mark this topic as resolved because it appears that nobody else is having this problem.