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

 

 

 

Link to comment
Share on other sites

Here we go:

 

------>>>>>>>>>>>

 

    $from = 'webmaster@xxx.com';

    $subject = "New Account Activation";

    $headers = 'From: support@xxx.com' . "\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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.