SwiftMailer does not send mail, why?
email, php, swiftmailer
Solution
I had the same problem.
According to the documentation swiftmailer.org by default Swift_MailTransport::newInstance() uses parameters `-f%s` and that is why you got `"-fnews@domain.de"`, to solve that place blank space between `-f %s`.
Your code now can be looks like that: `$message = Swift_Message::newInstance('-f %s')`;
I solved that problem simply passing `null` to __construct(). So my working code looks like that:
`$message = Swift_Message::newInstance(null)`;
I hope it will help someone.
P.S. I use Postfix to send emails.
Problem
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? Update In `Swift_Transport_SimpleMailInvoker::mail` I dumped out the parameters and got this: ``` $headers => string(208) "Message-ID: <1337173064.4fb3a4480b8dd@domain.de> Date: Wed, 16 May 2012 14:57:44 +0200 From: news@domain.de MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable " $extraParams => string(15) "-fnews@domain.de" ``` `$to, $subject, $body` is same as I used in `mail()`. Still no idea what the problem is. Update #2 This worked fine for me: ``` mail($email, 'Test', $nl_text, "From: " . ABSENDER); ``` Disclaimer: This is not a solution but the workaround I used, because I did not have the time to debugger the framework and find a real solution. Feel free to use the information given above to debug yourself and post your solution here. I will gladly accept and upvote it.