...

View Full Version : Mail delay problem



mrbadboy
02-28-2008, 06:34 AM
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@company.com \n";
$headers .= "Content-Type: text/html; charset=iso-8859-1\n"; // Mime type
$recipient = "raja@gsecone.com";
$subject = "Test subject";
$htmlbody = "Content text";
mail ($recipient, $subject, $htmlbody, $headers);

do you have any idea?

Thanks.

mrbadboy
02-28-2008, 12:33 PM
hi,

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
Code: ( php )

$qry = "insert into tbl values($val1,$val2)";
$res = mysql_query($qry);
if($res){
$isadded = true;
}
if($isadded){
$headers = "From:kamal@company.com \n";
$headers .= "Content-Type: text/html; charset=iso-8859-1\n"; // Mime type
$recipient = "raja@gsecone.com";
$subject = "Test subject";
$htmlbody = "Content text";
mail ($recipient, $subject, $htmlbody, $headers);
}

reply me if you have any idea....

Thanks.

abduraooft
02-28-2008, 01:05 PM
Ensure that there is no error in the query!

$res = mysql_query($qry) or die(mysql_error());



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum