Email on separate thread in php

Viewed 4935

I'm wondering if there is a way to start a separate thread in php to send and email. I have a small web service which takes some information from an iPad app and then inserts data into a db and sends an email afterwards. The problem is that sometimes the email takes too long to send and the iPad's request times out. Is there a way I could send the email on separate thread? I basically want to tell the iPad everything was successful before the email sends.

Some example code:

... Process info and insert into DB
echo "success"; //this should be returned to the iPad right away.

//start new thread here or possibly fork???
$email->send();

Thanks!

2 Answers
Related