Jump to content

MAIL() function to send an email when users register - But very Slow!


luciogodoy

Recommended Posts

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

 

 

 

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.