Mail problems
| From: | Jeff Wolkove | Date: | Sat, 15 Jul 2000 04:55:35 +0000 |
| Subject: | Mail problems | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-6732@lists.php.net to get a copy of this message | ||
I have an annoying problem with the mail() function intermittently
taking a long time to execute.
I checked the list archive and it was suggested to put the -q
switch on the command line, which, according to the article,
means that sendmail will queue the mail rather than sending it
immediately. I did that so the sendmail command line was
/usr/sbin/sendmail -tq
(The -t was there by default, so I left it there.)
This did not work at all, in fact the mail function executed
quickly but no mail was sent. I have not checked for a return
error code.
However this conflicts with the sendmail documentation. According
to the book, the -q switch tells sendmail to process its queue
and exit, and says nothing about just queueing the mail.
Reading further through the book, I find this option:
-ODeliveryMode=background
so the sendmail command line in php3.ini is now
/usr/sbin/sendmail -t -ODeliveryMode=background
which tells sendmail to fork a new process to deliver the mail
and exit immediately. This worked fine, it was fast, the mail
was delivered and I was happy -- for about an hour, then it
became slow again. It takes up to 2 minutes to send an e-mail,
and I have users registering 4 or 5 times because they think
the 'puter didn't hear them the first time they submitted the
form.
When I check the sendmail queue, it's empty. WHen I run a top
during this long waiting period, sendmail doesn't even appear in
the list of active processes. However I have checkpointed the
script extensively and know with 100% certainty that it's hung
up at the mail function.
Any clues would be appreciated.
Jeff Wolkove