====================THIS IS CALLEE========================
// do_sendmail.php
$m = new SimpleEmailServiceMessage();
$m->setFrom($d->from);
$m->addTo($d->to);
$m->addCC($d->cc);
$m->addBCC($d->bcc);
$m->setSubject($d->subject);
$m->setMessageFromString(strip_tags($d->content), $d->content);
$ses = new SimpleEmailService(AWS_SES_API_KEY, AWS_SES_API_SEC);
$ses->sendEmail($m,true);
By using '> /dev/null 2>/dev/null &' together with exec() we can do async curl to other http request successfully. But when we switch to SimpleEmailService, it doesn't work as excepted.
Is it possible to send email asynchronously? this is the code snippet we have.
====================THIS IS CALLER======================== $silent = '> /dev/null 2>/dev/null &'; $data = ... $d = json_encode($data); $payload = base64_encode($d); exec("php {$_SERVER['DOCUMENT_ROOT']}/class/do_sendmail.php \"$payload\" $silent");`
====================THIS IS CALLEE======================== // do_sendmail.php $m = new SimpleEmailServiceMessage(); $m->setFrom($d->from); $m->addTo($d->to); $m->addCC($d->cc); $m->addBCC($d->bcc); $m->setSubject($d->subject); $m->setMessageFromString(strip_tags($d->content), $d->content); $ses = new SimpleEmailService(AWS_SES_API_KEY, AWS_SES_API_SEC); $ses->sendEmail($m,true);
By using '> /dev/null 2>/dev/null &' together with exec() we can do async curl to other http request successfully. But when we switch to SimpleEmailService, it doesn't work as excepted.