[Resolved] WP Mail SMTP plugin + Toolset = won't send form notifications
This support ticket is created 2 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
When the WP Mail SMTP plugin is active, it gives me the following message:
SMTP error from remote mail server after end of data:
550 Messages should have one or no To headers, not 2.
It seems to be trying to add the recipient to the senders twice, sometimes along with the From email address for some reason, resulting in 2-4 To headers and the above error. I'm having trouble figuring out where I can deactivate whatever in Toolset is causing it to add the additional header(s) and thus to fail to send.
When WP Mail SMTP is deactivated, everything sends just fine, so I've had to deactivate it for now, but I need to re-activate it soon for other aspects of my site.
I just set up SMTP with that plugin on a local test site, and I'm not seeing any errors. Do I need the pro version to see the same?
I checked whether a form notification is adding 2 To: headers, and it doesn't appear to be, but if I can reproduce the same error you describe I can try and debug this locally.
It's not in WordPress; it's a Mail Delivery System email (the kind that comes when an email is undeliverable). They don't show up in the WP Mail SMTP Pro log at all. I got the Pro version of WP Mail SMTP, but I can see if it does the same with the Pro version. I've also attached a screenshot in case that helps.
Sure thing. I installed that and the issue still occurs with the (non-Pro) 2.6.0 version of the WP Mail SMTP plugin. Also, that version is OLD. The plugin is currently on version 3.3.0.
Thank you for the update. Do you have the option of using an alternative SMTP plugin? Our 2nd team managed to perform some tests and found that the WP Mail SMTP isn't working as intended.
Unfortunately I cannot speak of a way to make it work given that there are other SMTP plugins that work without any issues. As you mentioned this recently started to happen, which mean the fault is perhaps caused by an update in the WP Mail SMTP Pro plugin.
My advice is that you get in touch with the support team for the plugin so they can have a look. They are better equipped to debug this issue than we are here.
I've gotten in touch with WP Mail SMTP's team and they've asked if there's a way to switch Tollset's email notifications to use wp_mail() function instead of the default PHP mail function. They said this is what seems to be causing the issue with emails not being routed correctly.
The WP Mail SMTP team is looking into this, so I'll report back if we're able to find a solution or if there's nothing they're able to do to fix it. I know this is an issue for a number of folks based on the recent surge of tickets on here, so hopefully they'll be able to find a resolution for us all!
The WP Mail SMTP team has looked into this more - they've accessed some things through FTP and I sent them the header file from the emails that failed and they noticed some things. This is what they asked me to pass along:
"Upon checking, I noticed that specific email was not sent using the WP Mail SMTP plugin. You can see the name PHP Mailer under the "X-Mailer" header (see: hidden link).
If that email is sent using the WP Mail SMTP plugin, you should be able to see our plugin name under the "X-Mailer" header (see: hidden link).
As I have explained earlier, Toolset notification bypassed the WP Mail SMTP configured mailer. You can ask Toolset support to see if there's a way to force their notifications to use the WordPress default wp_mail() function (https://developer.wordpress.org/reference/functions/wp_mail/)."
I know you say that Toolset uses the wp_mail() function, but it looks like that may not be entirely the case based on what they found or else it's messing something else up. The email headers I forwarded them were sent when the WP Mail SMTP plugin (and ONLY that SMTP plugin) was active, so it SHOULD have been sent with WP Mail SMTP, so the only thing we can figure is that Toolset bypassed it somehow...
I used Xdebug to step through the code execution line-by-line when the notification was sent, and as described it simply prepares the email details and then uses the core WordPress wp_mail function to send it.
We don't have some secret code that we use as an alternative when WP Mail SMTP plugin is active, it's the same code that runs every time (including with the Post SMTP plugin, which works).
I can't account for why WP Mail SMTP would ordinarily intervene to take over sending the email but doesn't in this case, I'm afraid.
I was not implying that Toolset was intentionally sabotaging WP Mail SMTP or something, thank you very much. Thank you for looking into the Xdebug, though. It's extremely disappointing that there's nothing that can be done to fix the issue between Toolset and WP Mail SMTP, but I guess I'm switching to a less-than-ideal SMTP plugin in the meantime. I'll pass on the Xdebug info to the WP Mail SMTP team as well, in case this comes up for any of their other customers in the future.