Question:

PHP: mail-notification on job-completion and result page

by  |  earlier

0 LIKES UnLike

On my website I have a form that allows users to submit parameters for a program on the web server, which is called via PHP's exec()-command.

Since the processing time can be very long, I want to send the user a notification to his e-mail address when the job is completed. The mail message should contain the name of a temporary web address, showing the program's output. Does anybody know how to do this in PHP?

 Tags:

   Report

1 ANSWERS


  1. You should already have most of the pieces together for doing this long-running task.  You just need to add some nice touches to make the it look good for the users.  You should immediately output to the user that the process will take a long time to complete, and to wait for a response in their e-mail inbox, and to continue browsing if they like.  That is the end of the direct output to the browser from this task.  The next step is to do your standard processing for this task - either right then, or from a queue if  you need to load-balance these tasks.  The process will create some kind of output that you can either save to a "temporary" file on the web server, or, even better, put the output as a report in a database and tie it to that user so only he can request it.  The last step is to email the link to the temporary file or the PHP page that accesses the reports in the database (and authenticates the user before serving up the report).  If you use temp files, you'll need to figure out how to remove them after viewing or a certain period of time.

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.