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('myemail@mydomain.com', 'Test', 'Test',
array('from' => 'localhost@localhost.com'), true);
But the mail is not actually being sent. Anyone has any hint on that method?