1

I have a php page that updates a record in a database and answer to the client with a json string.

After this I need to send some email with an SMTP connection, this may take a few and i don't want to let the client wait for it. I just want the json answer, than I would like to close connection, flush the output and then start the mail sending. Is it possibile?

j0k
  • 22,600
  • 28
  • 79
  • 90
Tobia
  • 9,165
  • 28
  • 114
  • 219
  • 1
    Yes it's very possible. Make the mailing function into a separated PHP file and run that file in background. There're many insights on how to "PHP run process in background" over the Internet. – Passerby Feb 06 '13 at 08:27
  • You could either run it in a different process or another thread. I described different methods in the answer for another question here: http://stackoverflow.com/questions/209774/does-php-have-threading/14201579#14201579 – Francois Bourgeois Feb 06 '13 at 09:36

0 Answers0