wp_mail fails to send to multiple recipients
|Reported by:||patmcnally||Owned by:||nacin|
The function wp_mail as defined in wp-includes/pluggable.php does not correctly handle multiple recipients when they are passed in as a comma separated string to the first parameter($to). This is evident when using any SMTP server that strictly adheres to section 18.104.22.168 of rfc2821 (such as gmail).
For example when the first parameter to wp_mail is "foo@…, bar@…" this string is passed directly to the SMTP server in the first and only RCPT command. Expected behavior is two separate RCPT commands, one for each email address.
phpmailer supports the required functionality, however $phpmailer->AddAddress needs to be called multiple times for each email address contained in the first parameter ($to). Instead AddAddress is called only once, borking any attempts to send to multiple recipients when using gmail's SMTP server.
I would submit a patch, however this is my first time investigating both php and Wordpress and fear that I could only do more harm than good.
Change History (17)
- Keywords changed from wp_mail, smtp, mail, has-patch, needs-testing to has-patch needs-testing wp_mail, smtp, mail
- Milestone changed from Unassigned to 2.9
- Type changed from defect (bug) to enhancement
- Keywords needs-patch added; has-patch needs-testing removed
- Keywords has-patch needs-testing added; needs-patch removed
- Keywords changed from has-patch, needs-testing, wp_mail, smtp, mail to has-patch needs-testing wp_mail smtp mail
comment:10 @nacin — 5 years ago
- Keywords needs-testing wp_mail smtp mail removed
- Milestone changed from Future Release to 3.0