From #2681999-17: SMTP Error: Invalid address, but address not shown in watchdog:
Per Richard Eriksson (Acquia), it appears this was fixed in the SMTP module, but a subsequent security update came through and the change was reverted. Began seeing email failures on December 27, the day after the SMTP 7.x-1.6 security patch came out. First email in array will deliver fine (forms that only send to one email are thus unaffected.) Second and subsequent email addresses are all interpreted as invalid because of a leading space.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | smtp-error-multiple-addresses-2856373-4.patch | 493 bytes | joelstein |
Comments
Comment #2
joelstein commentedComment #4
joelstein commentedBetter patch.
Comment #5
Mayday commentedI was having this exact same problem that I had a Rule created with multiple email addresses separated by a comma and a space. I added in the patch from #4 and it worked perfectly. I would recommend pushing this to the new version. I didn't know that my Drupal instance was dropping emails if it had multiple addresses in it for about a month.
Comment #6
gg24 commentedHi,
I created a Rule to send emails to multiple addresses and it worked for me when i only separated emails by comma but when i added space too it didn't work.
After applying patch it worked as intended.
Thanks!
Comment #7
gg24 commentedComment #8
vtcore commentedHad the same issues. The patch works. Please commit :)
Comment #9
redeight commentedThis just saved me. #4 worked splendidly.
Comment #10
alexagui commented#4 worked for me as well. Thanks!
Why hasn't this been merged into stable release yet?
Comment #11
apotek commentedWe are having this exact same error, and I indepently wrote the same code as the patch here (should have checked the issue queue first). Evidently there are no D7 tests for sending commaspace separated email addresses :(.
Would love to see this included in the stable 7 release. This solution works.
As an aside, I find it interesting that
SMTPMailSystem->_get_components()does email address validation using Drupal'svalid_email_address(), whenPHPMailer->AddAnAddress()_also_ validates email addresses. Why validate twice? Is Drupal's validation function considered more complete/robust? I suppose it's a good way to maybe get Drupal's input filtering into code as opposed to relying on the maintainers of PHPMailer.Comment #12
bkosborneThere's a nearly identical patch in #2753115: Sending to multiple email addresses with comma-delimited list with spaces gives fatal error: "Invalid address" which was created first.