php mail() too slow, workarounds?

php mail() too slow, workarounds?

Posted by: here
Posted on: 2006-07-16 18:19:00


php mail() function is too delayed to provide reliable notification following web purchase.

A client is attempting to sell a service requiring immediate action via their site. When a customer places an order, the information is recorded into a database and an email is sent to both the customer and provider using php's native mail() function. These mails have been arriving occasionally delayed - sometimes immediately; sometimes 6+ hours late! This seems to be par for the course with the current dh setup and has been consistetly erratic for the past 2 weeks.

The order shows up immediately in the database. Unfortunately, the provider has no idea there is a new order without constantly refreshing a database view!

Is there a way to eliminate the delay with mail()?

Is there an alternative to mail() which will eliminate the delay?
* PEAR:Mail : http://pear.php.net/package/Mail
* phpmailer: http://phpmailer.sourceforge.net/
* p3mailer: https://sourceforge.net/projects/p3mailer/
* email() from POSS : http://poss.sourceforge.net/email/index.php?type=Documentation

Does someone have a better idea than email as to how to contact about a new order. (maybe Jabber?)

Thanks

See also
* http://discussion.dreamhost.com/showflat.pl?Cat=&Board=forum_programming&Number=33763


. .. ...:herebox.org:... .. .

Re: php mail() too slow, workarounds?

Posted by: scjessey
Posted on: 2006-07-16 18:43:00

In reply to:

php mail() function is too delayed to provide reliable notification following web purchase.


I disagree. I have found the mail() function to be completely reliable. Any delays I have experienced have been Sendmail issues, as far as I can tell.

Re: php mail() too slow, workarounds?

Posted by: here
Posted on: 2006-07-17 06:17:00

Thanks for the thought! Could you maybe expand a bit? Your current response doesn't really get me anywhere. Does that mean I am not using sendmail correctly? I am using simply mail($email, $subj, $text, $headers); .

Across the past two weeks I've been testing this service, emails have been regularly delayed following the form submission.

If this is a sendmail issue -- then the same question applies -- how do I work around the sendmail delays?

The service being sold is one that would be ideally /completed/ within 15 minutes of purchase. That means a delay of even 10 minutes is the upper limit of acceptibility. I realize there are a huge number of factors which can delay email -- but these delays appear to be somewhere between php and dreamhost.

. .. ...:herebox.org:... .. .Edited by here on 07/17/06 06:23 AM (server time).

Re: php mail() too slow, workarounds?

Posted by: scjessey
Posted on: 2006-07-17 07:34:00

In reply to:

Does that mean I am not using sendmail correctly? I am using simply mail($email, $subj, $text, $headers); .

Across the past two weeks I've been testing this service, emails have been regularly delayed following the form submission.

If this is a sendmail issue -- then the same question applies -- how do I work around the sendmail delays?

The service being sold is one that would be ideally /completed/ within 15 minutes of purchase. That means a delay of even 10 minutes is the upper limit of acceptibility. I realize there are a huge number of factors which can delay email -- but these delays appear to be somewhere between php and dreamhost.


You are definitely using mail() correctly (see this wiki article for confirmation). The problem is definitely within the mail server, and it is intermittent. I just tested four of my forms, and I received all four emails immediately. I don't know of any way to get around the problem, I'm afraid, but it normally works just fine.

Re: php mail() too slow, workarounds?

Posted by: here
Posted on: 2006-07-17 10:59:00

here is another report, also across weeks, describing almost exactly my symptoms. somtimes immediate, but often delayed and delivered in bunches.

looks like you were right in pushing the problem past php's mail() and onto sendmail.

thread in programming forum: sendmail Delays for Hours?

. .. ...:herebox.org:... .. .

Re: php mail() too slow, workarounds?

Posted by: etechsupport.net
Posted on: 2006-07-25 14:51:00

Mail queue on your server has become huge and it shoould be cleaned to keep sendmail service running all the time. There maybe someone spamming from the server which is crashing sendmail service.

http://www.etechsupport.net

Tags: php mailmail functionsourceforge netemaildreamhostphpmailerunfortunatelycontactpearideaoccasionallyhttpsjabberhttp