How to send spool from swiftmailer without using command?
php app/console swiftmailer:spool:send --env=prod
I need to put this somehow into php file so that Server admin can add this to Schedule.
This can also be achieved by How can I run symfony 2 run command from controller , so you don't duplicate code. Worked for me.
services.yml:
services:
swiftmailer.command.spool_send:
class: Symfony\Bundle\SwiftmailerBundle\Command\SendEmailCommand
calls:
- [ setContainer, ["@service_container"] ]
Controller code (simplified):
$this->get('swiftmailer.command.spool_send')->run(new ArgvInput(array()), new ConsoleOutput());