luciogodoy Posted November 26, 2007 Share Posted November 26, 2007 Hi All; I have created a registration page for my site, and once the information provided is validated OK, the script inserts all the data on to MYSQL and after that it sends a Welcome Email to the user. My problem is that the user has to wait sometimes few minutes, with the form on front of then while the script is sending the mail. My questions are: 1) Is there a way to "pipe/delegate" the email job to another script while freeing the form web page, as in the Process Flow: Form Completed ------(3 seconds)----> New page "welcome to the Club" --( fork another script)---(1 to 4 minutes)----> Send Welcome email to the user 2) While the email is being sent, the form page refreshed to a "Waiting Bar.GIF" and when the email is sent it refreshed to a new page like: "welcome Html Page"? My prefered method woul dbe number 1! Thank you Lucio Link to comment https://forums.phpfreaks.com/topic/78899-mail-function-to-send-an-email-when-users-register-but-very-slow/ Share on other sites More sharing options...
Sulman Posted November 26, 2007 Share Posted November 26, 2007 It might be worth looking at your mail script. 1-4 mins is far to long to send one email. Can you post the code. Link to comment https://forums.phpfreaks.com/topic/78899-mail-function-to-send-an-email-when-users-register-but-very-slow/#findComment-399363 Share on other sites More sharing options...
luciogodoy Posted November 26, 2007 Author Share Posted November 26, 2007 Here we go: ------>>>>>>>>>>> $from = '[email protected]'; $subject = "New Account Activation"; $headers = 'From: [email protected]' . "\r\n"; $template = "account_activation/welcome_to_xxx.txt"; $FileHandle = fopen($template, 'r') or die("can't open file template"); $contents = fread($FileHandle, filesize($template)); fclose($FileHandle); $message = str_replace("RANDON_FILE_NAME", $randon_file_name . ".php", $contents); mail($primary_email, $subject, $message, $headers); <<<<<<<<<<<<<<------------------------------------------- That is it !! Thanks Lucio Link to comment https://forums.phpfreaks.com/topic/78899-mail-function-to-send-an-email-when-users-register-but-very-slow/#findComment-399388 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.