By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,968 Members | 1,684 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,968 IT Pros & Developers. It's quick & easy.

Mail delay problem

P: 21
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.
Feb 28 '08 #1
Share this Question
Share on Google+
2 Replies


Markus
Expert 5K+
P: 6,050
I don't understand your problem.
Feb 28 '08 #2

P: 21
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,$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);
}[/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
Feb 28 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.