Mail delay problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mrbadboy
    New Member
    • Jul 2007
    • 21

    Mail delay problem

    Hi,

    I need to insert some records to a table and then need to send a mail. while using mail() function in php, it takes 20 to 25 seconds to send a mail. insert query executes immediately. but if i do any operation in the page it takes 20-25 seconds. it works properly when i get the mail.

    code which im using my page.
    $headers = "From:kamal@com pany.com \n";
    $headers .= "Content-Type: text/html; charset=iso-8859-1\n"; // Mime type
    $recipient = "raja@gsecone.c om";
    $subject = "Test subject";
    $htmlbody = "Content text";
    mail ($recipient, $subject, $htmlbody, $headers);

    do you have any idea?

    Thanks.
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    I don't understand your problem.

    Comment

    • mrbadboy
      New Member
      • Jul 2007
      • 21

      #3
      Originally posted by markusn00b
      I don't understand your problem.

      hi mark,
      thanks for your reply... actually i've to do two operations. one is to insert records to database (im using mysql) and another one is to send a mail to somebody.
      In my code first im using insert query then im using mail(). The problem is, while submitting my form i cann't able to do any another operation which is related to corresponding table (where i inserted records) like i cann't select particular records (using SELECT query) or i cann't show the newly added records to my list. i can do it normally when the mail will be sent. So how can i continue any operation after insert a record. that is i don't want to wait to send a mail.

      My code is
      [php]
      $qry = "insert into tbl values($val1,$v al2)";
      $res = mysql_query($qr y);
      if($res){
      $isadded = true;
      }
      if($isadded){
      $headers = "From:kamal@com pany.com \n";
      $headers .= "Content-Type: text/html; charset=iso-8859-1\n"; // Mime type
      $recipient = "raja@gsecone.c om";
      $subject = "Test subject";
      $htmlbody = "Content text";
      mail ($recipient, $subject, $htmlbody, $headers);
      }[/php]reply me if you have any idea....

      Thanks.

      See the Posting Guidelines before you show any more code! Code must be enclosed within the appropriate code tags. - moderator
      Last edited by ronverdonk; Feb 28 '08, 10:05 AM. Reason: warning and code within tags

      Comment

      Working...