[TYPO3-core] RFC #17336: Swift Mailer Adapter does not parse To: addresses

Ernesto Baschny [cron IT] ernst at cron-it.de
Wed Jan 26 14:27:57 CET 2011


Jigal van Hemert schrieb am 26.01.2011 13:35:
> Hi,
> 
> This is a SVN patch request.
> 
> Type: Bugfix
> 
> BT reference: http://bugs.typo3.org/view.php?id=17336
> 
> Branches: trunk
> 
> Problem:
> If t3lib_utility_Mail is called with a recipient in the $to parameter
> which is not a plain simple mail address but has a name included (e.g.
> "my name" <me at example.org> ) it will throw an exception inside Swift Mailer
> 
> Solution:
> process $to with parseAddresses before setting the To: value
> 
> How to test:
> Send mails with Direct Mail, which uses
> "The name" <name at example.org>
> format for the recipient.

After a short brainstorming with Steffen about it, we went through the
case where "$to" is not set when calling this. Three choices:

1) don't call setTo() at all (current case) = PHP Fatal Error :(

2) call setTo(array()) = No error, just $mailer->send() will later
return "0" (as of "zero mails were send").

3) call setTo('') = Exception thrown: "Address in mailbox given [] does
not comply with RFC 2822, 3.6.2."

The third one gives best flexibility in case the caller wants to handle
this condition (e.g. a newsletter engine might want to log this
somewhere and continue).

The problem is that we are dealing with a adapter for the "mail()"
method, and this is not expected to "throw an exception". So variant "2"
would be the one that is most compatible in this situation.

Which is what I propose in the attached follow-up. Agreed?

Cheers,
Ernesto
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 17336-followup.diff
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20110126/afd8244f/attachment.txt>


More information about the TYPO3-team-core mailing list