I'm using Symfony 2.7 which comes with SwiftmailerBundle 2.3.8.
This is my configuration
swiftmailer:
mailers:
spool_mailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
spool:
type: file
path: %kernel.root_dir%/spool
instant_mailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
default_mailer: spool_mailer
I want to use 2 mailers, one for spooling and one for sending them instantly.
These two commands will work just fine, the email is either spooled or sent instantly.
$this->get('swiftmailer.mailer.instant_mailer')->send($email);
$this->get('swiftmailer.mailer.spool_mailer')->send($email);
However,
$this->get('mailer')->send($email);
Doesn't fetch the default_mailer
which is the spooler in my case, but it sends it instantly. I've seen here that this is possible, but maybe that answer is incorrect.
Did I miss something in the configuration file? Or am I not calling it right?