Wednesday, May 16, 2012

SwiftMailer does not send mail, why?

SwiftMail does not send my email, while mail() does work. Same as here.



I added the EchoLogger but it does not print anything.



$message = Swift_Message::newInstance();
$message->setSubject('Test');
$message->setTo( $email );
$message->setFrom(ABSENDER);
$message->setBody($nl_text);

$transport = Swift_MailTransport::newInstance();
$mailer = Swift_Mailer::newInstance($transport);

$logger = new Swift_Plugins_Loggers_EchoLogger();
$mailer->registerPlugin(new Swift_Plugins_LoggerPlugin($logger));

$result = $mailer->send($message, $failures);
var_dump($failures);


The email is returned in $failures but why?





No comments:

Post a Comment