awesomemotive/WP-Mail-SMTP

Comma separated list of emails & wp_mail() - not all emails are sent

ventouris opened this issue · 2 comments

Plugin version

1.2.5

Current Behavior

I installed and setup the plugin a while ago. Everything works great. New users, new orders and any kind of email notification are sent from the custom SMTP I used.

However, I had to use the built-in function wp_mail() for a custom event notification and the sender is as “noreply@testmail.com”. So, the mail fails to reach the destination.

$to = 'email1,email2,email3';
    $subject = 'This is a subject';
    $body = 'Here is a body';
    $body .= '<br><br><br>';
    $body .= 'Let's add another body';
    $headers = array('Content-Type: text/html; charset=UTF-8');
 
    wp_mail( $to, $subject, $body, $headers );

Expected Behavior

I expected to use the email I added on the SMTP plugin instead of this placeholder.

It might be related to a comma separated list of emails. Some other people reported that as well, I'm investigating, and if the issue is confirmed - it will be fixed in the next 1.3.0 release.

CF7 has the same issue, WPForms does not.
Reason: CF7 sends to multiple emails using one wp_email() call (I think the same for GF), while WPForms calls wp_mail() the number of emails it can identify.
These multiple values in a single TO property then headed to wp_mail() -> phpmailer -> ->send() -> ->smtpSend() -> smtp->recipient() and all responses are truthy there during my tests. So I think that's the issue with STMP server that receives this data, not with the WP Mail SMTP plugin.

Closing as won't do.