Email Results from Long PHP Script


Tags: php email
标签: php email

问题 (Question)

I need to process a long PHP script and have the results emailed to the user once the script has completed. How is this done?


最佳答案 (Best Answer)

You might want to use the mail() function. You need an SMTP server set up on your server to do so. See details in the documentation:

Edit: if you use PHPmailer class, you can simply save the pdf and





答案 (Answer) 2

I'm not sure that you really need to decouple the script from PHP, but if that's really what you are wanting to do, you can set a value in a MySQL table to reflect that the script has finished. Then, run a cron job to check to see if the value in MySQL is set. If so, send out the mail. If not, go back to sleep and check again next minute.