Sending mail fails with quotes around display name part of address (regression from r5033?)
|Reported by:||nkinkade||Owned by:|
I'm getting a 'sendingfailed' error when the display name of an email address has double quotes around it. For example:
"Fist Last" <firstlast@…>
This error started happening when I updated to trunk a few days ago. The problem appears to have been introduced in r5033 in file program/steps/mail/sendmail.inc on line 147:
$email_regexp = '(\S+|("\s*(?:["\f\n\r\t\v\b\s]+\s*)+"))@\S+';
For some reason the 2nd to last + is causing the regex to not match anything in the above example email address. I'm not sure how a + functions outside of round brackets. It's a syntax I'm not familiar with, but in any case removing it seems make the expression work as expected. The result is that $mailto is empty on line 217 and then gets set to "undisclosed-recipients:;" on line 231, which triggers an error from the SMTP server of no valid addresses. See attached patch.