Closed proArtex closed 2 years ago
--env
argument means that Kernel will be initiated with that environment, and is common argument for every console command.
It has no idea which mails you sent from where.
If you want to send mail from different environments then you have to set up different spools/spool paths per environment:
swiftmailer.yaml:
swiftmailer:
spool:
type: 'file'
path: '%kernel.project_dir%/var/%kernel.environment%/mails'
If it works so, it's better to mention this fact in documentation. At least with path you've provided.
Why tho? You just could check out var/mails
folder to find out that there's nothing about environments, just mail files. If you think it is a common case and the code sample would be better with %kernel.environment
in it you can send a PR. If your issue is resolved you can close it.
Closing as Swiftmailer is not maintained anymore and in any case, the spool feature of Swiftmailer was really weak. Migrating to Symfony Mailer would give a way better way to send emails async.
Symfony: 4.0.11 Bundle: 3.2.2
Here is my config:
and command:
bin/console swiftmailer:spool:send --env=dev
It sends emails generated by any environment.