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.

Comments

joelstein created an issue. See original summary.

joelstein’s picture

Status: Active » Needs review
StatusFileSize
new796 bytes

Status: Needs review » Needs work

The last submitted patch, 2: smtp-error-multiple-addresses-2856373-2.patch, failed testing.

joelstein’s picture

Status: Needs work » Needs review
StatusFileSize
new493 bytes

Better patch.

Mayday’s picture

I 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.

gg24’s picture

Status: Needs review » Needs work

Hi,

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!

gg24’s picture

Status: Needs work » Reviewed & tested by the community
vtcore’s picture

Had the same issues. The patch works. Please commit :)

redeight’s picture

This just saved me. #4 worked splendidly.

alexagui’s picture

#4 worked for me as well. Thanks!

Why hasn't this been merged into stable release yet?

apotek’s picture

We 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's valid_email_address(), when PHPMailer->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.

bkosborne’s picture