PHP mail() woes

fouldragon at aol.com fouldragon at aol.com
Wed Jun 11 17:44:17 MST 2008


Several sites on the VPS I administer send out several "order 
confirmation" emails when a specific page is hit.

Because of the way they run their businesses, it's non-negotiable that 
between 3 and ~12 messages are sent out on these occurences.

The problem is that occasionally--- probably about one in 20 times such 
a page is accessed, the server error logs fill up with:

[Wed Jun 11 13:38:06 2008] [error] [client a.b.c.d] PHP Warning:  
mail() [<a href='function.mail'>function.mail</a>]: Could not execute 
mail delivery program '/usr/sbin/sendmail -t -i' in 
/var/www/vhosts/xxxxxxx/httpdocs/feedback.php on line 54, referer: 
http://xxxxxxxx

Since it tries to send a handful of messages at once, they usually come 
in clumps of 5 or 6 messages like this.

I tried correlating the times of the errors with resource warnings in 
Virtuozzo; no dice.

I keep hearing that the PHP mail() call is not intended for bulk 
mailing-- but less than 20 messages at a shot is not bulk as I see it.

The only thing I could see is some sort of resource exhaustion... like 
it can only have xxx mail() calls in the air at once, and it exceeds 
that limit.

The server runs FC6 with Plesk 8.3 on top, so the mail setup is qmail, 
but it uses xinetd.  I saw a few notes about being able to tweak 
qmail-smtpd to open more instances, but I'm not even sure that's 
relevant to the problem (since mail() calls are coming from local).

What about replacing /usr/sbin/sendmail -t -i with 
/var/qmail/bin/qmail-inject - someone suggested this?  Would that have 
any possible difference?

And what's a good way to find out if this will repeat, other than 
sitting and monitoring the logs for an error?



More information about the PLUG-discuss mailing list