Im using swiftmailer for sending mails from my symfony2.2 project. Is there a way to log globally all email info and send results?
It would be great if mailer send
Adding the following to the 'services' section of your configuration will print interaction with the transport to stdout (which can be useful if you're debugging by using the console commands, e.g. 'swiftmailer:email:send' or 'swiftmailer:spool:send'):
services:
# (...)
swiftmailer.plugins.loggerplugin:
class: 'Swift_Plugins_LoggerPlugin'
arguments: ['@swiftmailer.plugins.loggerplugin.logger']
tags: [{ name: 'swiftmailer.default.plugin' }]
swiftmailer.plugins.loggerplugin.logger:
class: 'Swift_Plugins_Loggers_EchoLogger'
arguments: [false]
Example output, using SMTP transport to localhost:
$ app/console swiftmailer:email:send --subject="Test" --body="Yo! :)" --from="user@example.com" --to="user@example.com"
++ Starting Swift_Transport_EsmtpTransport
<< 220 example.com ESMTP Exim 4.86 Thu, 07 Jan 2016 13:57:43 +0000
>> EHLO [127.0.0.1]
<< 250-example.com Hello localhost [127.0.0.1]
250-SIZE 52428800
250-8BITMIME
250-PIPELINING
250-AUTH PLAIN LOGIN
250-STARTTLS
250 HELP
++ Swift_Transport_EsmtpTransport started
>> MAIL FROM:
<< 250 OK
>> RCPT TO:
<< 451 Temporary local problem - please try later
!! Expected response code 250/251/252 but got code "451", with message "451 Temporary local problem - please try later"
>> RSET
<< 250 Reset OK
Sent 0 emails
++ Stopping Swift_Transport_EsmtpTransport
>> QUIT
<< 221 example.com closing connection
++ Swift_Transport_EsmtpTransport stopped