mail function delay for seconds

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
billing
Forum Newbie
Posts: 1
Joined: Tue Jun 20, 2006 9:09 am

mail function delay for seconds

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

mail() is that way.

Use SwiftMailer or phpMailer.
Post Reply