That's it, how can I send an email in background with CakePHP, preferable using the out-of-the-box Email component?
EDIT: with in background I mean in another thread, or at least allowing the controller method to finish and send the response to the user. I want to run a function, return "OK" to the user and, after that, send an email.
If it's not possible, how could I do it using the PHP mail
function? (only if it's a good approach)
Don't know if it matters, but I'm using SMTP.
Thank you in advance.
EDIT 2: I'm trying to use the CakeEmail::deliver()
method, as I read from the documentation that:
Sometimes you need a quick way to fire off an email, and you don’t necessarily want do setup a bunch of configuration ahead of time. CakeEmail::deliver() is intended for that purpose.
I'm trying this:
CakeEmail::deliver('[email protected]', 'Test', 'Test',
array('from' => '[email protected]'), true);
But the mail is not actually being sent. Anyone has any hint on that method?
Copyright Notice:Content Author:「sonxurxo」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/12268361/how-to-send-an-email-in-background-with-cakephp