[TYPO3-core] RFC #17065: Use Swift Mailer in core (was: Swift Mailer Adapter does not support file attachment and nested MIME parts)

Ernesto Baschny [cron IT] ernst at cron-it.de
Fri Jan 21 12:21:25 CET 2011


Georg Ringer schrieb am 21.01.2011 11:55:
> Hi,
> 
> Am 20.01.2011 16:52, schrieb Jigal van Hemert:
>> Instead of making the adapter support all mail features and oddities
>> it's better to use Swift Mailer directly and motivate extension
>> developers to do so also.
> 
> I don't know if that is the best way to go. Maybe one time we change to
> another mail tool and then we have to adobt again all places in the core.
> 
> Why not using t3lib_utility_Mail::mail once and ever and it would be a
> single place to change later on.

You cannot create RFC compliant mails with Mail::mail. The API allows
the caller to set "any headers" at will. No requirements for correct
email addresses, correct encoding, nothing.

If we want an API that is strict and doesn't allow it we would have to
create "our own SwiftMailer". Since SwiftMailer is there and the API is
very good and very stable, we use it.

The only wrapper that we have allow the most simple situations to be
easily exchangeable (creating simple mails):

$mail = t3lib_div::makeInstance('t3lib_mail_Message');
$mail->setFrom(array($email => $name))
     ->setTo(array($email => $name))
     ->setSubject($subject)
     ->setBody($body)
     ->send();

See, no reference to SwiftMailer.

We could add more wrappers later on (for creating attachments and custom
headers for example), but there is not time now. This is something for
4.6 or later (refining the API).

Cheers,
Ernesto


More information about the TYPO3-team-core mailing list