michelsalib / BCCResqueBundle

The BCC resque bundle provides integration of php-resque to Symfony2. It is inspired from resque, a Redis-backed Ruby library for creating background jobs, placing them on multiple queues, and processing them later.
122 stars 91 forks source link

Mailer Not Working Within A Job #108

Closed bassrock closed 8 years ago

bassrock commented 10 years ago

I am currently having an issue where the Symfony 2 Mailer service does not seem to be sending email messages in the memory spool when sent from inside a job.

Anyone else seeing this or see why this would be the case?

bassrock commented 10 years ago

Ok so the issue has to do with the kernel. The jobs do not terminate the kernel which calls the terminate listener to actually send the email in the memory.

I had to add

$this->getContainer()->get('kernel')->terminate(new Request(), new Response());

After this mail sent fine. Is there a way to add the kernel events/triggers to the Jobs?

ruudk commented 10 years ago

You should release the mailer spool yourself http://stackoverflow.com/questions/13122096/unable-to-send-e-mail-from-within-custom-symfony2-command-but-can-from-elsewhere