[TYPO3-v4] Swift Mailer is coming for v4.5...
Jigal van Hemert
jigal at xs4all.nl
Sat Aug 28 08:41:38 CEST 2010
Hi,
On 27-8-2010 15:27, Ernesto Baschny [cron IT] wrote:
> I would like to try to stick as close as possible to the SwiftMailer
> interfaces, so that we don't have to change that much, instead of
> orienting myself on the old t3lib_htmlmail. And also having the benefit
> of providing a "well known API" that people from other projects might be
> aware of, and also providing a smooth path to transition to FLOW3, which
> will have a very similar Interface.
Just read the SwiftMail docs briefly and it looks interesting!
Since FLOW3 is still alpha, it can also learn from the v4 version!
> Here are the way-to-do-it in SwiftMail, as a comparison:
> public function send();
SwiftMail send() seems to expect a message as parameter and optionally a
reference variable to give feedback on the failures (unfortunately
without specific errors).
> $message->setBody('My<em>amazing</em> body', 'text/html');
> $message->addPart('My amazing body in plain text', 'text/plain');
This is a rather strange concept: one method for the first part you add
and a different method for each following part. I'd stick with
->addBodyPart() myself.
> $message->setSubject($subject);
> $message->setFrom(array('some at address.tld' => 'The Name'));
> => adds From: header
> $message->setSender('your at address.tld');
> => adds Sender: xx and Return-Path: unless Return-Path explicitly set
> $message->setReturnPath('bounces at address.tld');
> $message->addReplyTo($address, $name);
Strange, some set... and some add... methods.
These are all headers.
> $message->setTo(array('some at address.tld', 'other at address.tld'));
> $message->setCc(array('some at address.tld', 'other at address.tld'));
> $message->setBcc(array('some at address.tld', 'other at address.tld'));
> $message->addTextHeader($name, $value);
> $message->addDateHeader($name, $value);
> $message->addMailboxHeader($name, array($email => $name));
Hey, there's more :-)
To me there are two cases: headers with a single value and headers with
multiple values.
-> setHeader( headerType, value [, headerName])
overwrites existing value if it exists
-> addHeader( headerType, value [, headerName])
headerType: constant with types such as MAIL_HEADER_FROM,
MAIL_HEADER_REPLYTO, ... , MAIL_HEADER_CUSTOM (names not as a
suggestion, but just to explain)
value: if custom header type the value must be encoded correctly,
otherwise the mailer will take care of that.
headerName: for custom headers
> $message->attachFromFile($filename, $mimeType);
> $message->attachData($data, $filename, $mimeType);
We should be able to set the disposition and filename (inside mail),
shouldn't we?
> $message->embedFromFile($filename, $mimeType); # returns a cid: url that
> can be used inline
> $message->embedData($data, $filename, $mimeType); # returns a cid: url
> that can be used inline
>> public function getSubject();
>> public function getSender();
>> public function getReplyTo();
>> public function getCc();
>> public function getBcc();
>> public function getReturnPath();
> ditto in SwiftMailer.
Do we really need so many get<headerType> functions?
Furthermore there are some interesting plugins in swiftmailer. Are you
planning to put them in the implementation? Logger, decorator are
useful, plus a queueing mechanism would be great :-)
Good to see improvements in the mailer section of the API!
--
Kind regards / met vriendelijke groet,
Jigal van Hemert
skype:jigal.van.hemert
msn: jigal at xs4all.nl
http://twitter.com/jigalvh
More information about the TYPO3-project-v4
mailing list