Page 1 of 1

mail function delay for seconds

Posted: Tue Jun 20, 2006 9:15 am
by billing
when submit a form, the web page goes to a server side php page "send_note.php",

the code of the send_note.php is mail some text content to servel people.

when finish the mail(), the simple code is like

Code: Select all

foreach ($to_array AS $to_mail) {
     $IS_MAIL = mail($to_mail, $xxx, xxx, xxx);
}

echo "<script>alert('send '" . count($to_array) . " mails successfully .')</script>";

The fuction works.

But it always spend 5 or 6 seconds for sending one email,
it maybe spend 30 or 40 seconds in total.
It spend too much time !!

Is there any way to avoid the problem?
maybe let the php mail() needn't to receive the return value (true or false),
or config the sendmail timeout parameter to 1 or 0 second ?

How does other php case to deal this kind of problem ?

Thanks to you all.

Billing

Posted: Tue Jun 20, 2006 9:37 am
by feyd
mail() is that way.

Use SwiftMailer or phpMailer.