Skip to content
This repository has been archived by the owner on Feb 6, 2022. It is now read-only.

Memory spooling not working within Commands #23

Closed
Sgoettschkes opened this issue Sep 18, 2012 · 15 comments
Closed

Memory spooling not working within Commands #23

Sgoettschkes opened this issue Sep 18, 2012 · 15 comments

Comments

@Sgoettschkes
Copy link

Setting swiftmailer up with the memory spooling does not work as the kernel seems to never terminate so the onKernelTerminate is never triggered.

I experienced this with the standard setup of symfony 2.1 (the configuration files are from RC1) where none of my emails sent through a command got sent. Removing the spooling options from my configuration, emailing went fine.

I don't know if it's possible to change the console to terminate the kernel so the emails get sent. This would of course be best.
If this is not possible, maybe the documentation should state this and offer ways to work around this.

@stof
Copy link
Member

stof commented Sep 18, 2012

It cannot terminate the kernel as this requrie a Request and a Response.

The way to send emails from a command is to either flush the memory spool by hand or to create a separate environment where the spool is disabled and use it to run the command.

Once symfony/symfony#3889 is merged, it should become possible to flush the memory spool automatically in the console too, but this will be for 2.2, not for 2.1.x

@Sgoettschkes
Copy link
Author

Ok, so would it be good to add this to the documentation, especially since symfony 2.1 ships with the memory spooling as a default? If so I would see if I can find some time to add a description of the problem and a code example of how to sent spooled messages.

@scheb
Copy link

scheb commented Sep 25, 2012

Took me about an hour to figure out this problem. Would be really good if it was documented somewhere, e.g. in the symfony console documentation.

@Sgoettschkes
Here's an example how to force a flush of the spool memory: http://sgoettschkes.blogspot.de/2012/09/symfony-21-commands-and-swiftmailer.html

@istaveren
Copy link

Please update the doc. I also spend more then one hour on it.

@Sgoettschkes
Copy link
Author

@sheb that's actually my blog post
@istaveren I'll add that to my todo. But it will take me some time, so if anybody else want to add it to the docs, please go ahead.

@Moinax
Copy link

Moinax commented Oct 30, 2012

@scheb Great that save my day 👍

@kbond
Copy link
Member

kbond commented Dec 5, 2012

memory spooling is also not working with monolog

@Sgoettschkes
Copy link
Author

I don't think this is related to this issue, is it? Depending on what you think is the source of this bug, could you please report it to either monolog or the monolog bundle.

@kbond
Copy link
Member

kbond commented Dec 6, 2012

I believe it is related to #6 - when spooling is active, emails are not sent by monolog. There needs to be an ability to have "high priority" emails that bypass the spool.

@Koc
Copy link

Koc commented Aug 23, 2013

So events added to console commands. How about implement flushing?

@mcfedr
Copy link

mcfedr commented Mar 24, 2014

With this in mind, it would also be great to have an option to disable spooling, with long running commands its not desirable to waiting until the command is about to exit before sending mails

@stof
Copy link
Member

stof commented Apr 5, 2014

@mcfedr remove the spool configuration from your config, and it will disable the spooling

@mcfedr
Copy link

mcfedr commented Apr 5, 2014

@stof thanks! that is not at all obvious from the docs btw :)

@Koc
Copy link

Koc commented Jun 14, 2014

Looks like #64 fixed this issue, isn't it?

@Tobion
Copy link
Contributor

Tobion commented Jul 24, 2014

Yes, closing

@Tobion Tobion closed this as completed Jul 24, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants