dimanche 28 juin 2015

Asynchronous PHP call to send email

I need to send an email (email.php) which should process asynchronously with main execution. Any echo, error etc happens in the email should not come in play in the main execution. Also the main execution should proceed without having to wait for email to send or fail to send.

Currently an ajax call is made to process.php file which end like the one below. But sendProcessEmail() gets executed first before jumping to next line of code, which is normal. But how could i make sendProcessEmail() asynchronous?

$processdata($sid);
sendProcessEmail($data_email, $data_displayname);// asynchronous 
$form_data = $getLatestData(); // this line should execute right after sendProcessEmail() is called
echo json_encode($form_data);

Aucun commentaire:

Enregistrer un commentaire