PHP/PEAR mail error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
curseofthe8ball
Forum Commoner
Posts: 73
Joined: Sun Jun 01, 2003 12:33 am

PHP/PEAR mail error

Post by curseofthe8ball »

We are experencing some problems with the use of PHP's mail() function. Our support staff told us that the mail() function has some limitations and told us to look into using PEAR's mail() function as an alternative. We did that but the same issue is happening.

To give you a little background, we use the mail() command to send out a confirmation email when someone fills out a form or submits a reservation for any of our various client sites. The problem is only occuring for our one specific client which just happens to be the site that uses the script the most as they take online reservations for various events and dining purposes.

The error we are receiving is:

Warning: mail() [function.mail]: Could not execute mail delivery program '/usr/sbin/sendmail -oi -t' in /usr/lib/php/Mail/mail.php on line 109

This error does not occur all the time but when it does, no emails are sent which has caused some internal problems with regards to the client's members expecting to receive confirmation and with our client's employees trying to track the reservations. The reservations are stored in a database so we are able to verify that the reservations are being made but for some reason the mail script errors out for some reservations.

I'm hoping someone has a vast knowledge of the mail() function, either with PHP or PEAR, and can help us troubleshoot the issue and learn more about any limitations with it (such as, is there a max number of connections at one time, is there a way to cache/store the email confirmations if the script fails and have it resent when the function becomes stable again).

We are willing to pay whomever for their assistance on this matter so please reply here and we can discuss this further by email or private message.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: PHP/PEAR mail error

Post by Kieran Huggins »

I've been around the block with mail() and have been converted to the ways of SwiftMailer - it's pretty great.

http://www.swiftmailer.org
curseofthe8ball
Forum Commoner
Posts: 73
Joined: Sun Jun 01, 2003 12:33 am

Re: PHP/PEAR mail error

Post by curseofthe8ball »

Kieran,

Thanks for the reply and link. I've downloaded SwiftMailer and have installed it. It works nicely and I'll need to play with it a bit more before adding it to our client's live site.

In regards the the log system, do you know how to set it up and how to get data from the log? That interests me as I'd like to setup the logging before I add this to their site so I can watch things closely.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: PHP/PEAR mail error

Post by Kieran Huggins »

Logging @ the SM docs: http://www.swiftmailer.org/wikidocs/v3/misc/logging

Help forum (part of these boards): viewforum.php?f=52
curseofthe8ball
Forum Commoner
Posts: 73
Joined: Sun Jun 01, 2003 12:33 am

Re: PHP/PEAR mail error

Post by curseofthe8ball »

Kieran,

I've looked over the docs and the forum but I can't find any real detailed notes on how to setup the logging. I have added the following the the mail script:

Code: Select all

$log =& Swift_LogContainer::getLog();
$log->setLogLevel($whatever_level);
However, how do I read from the log? I don't see any details on that or if I'm supposed to CHMOD any specific files to allow the log (which file is the log?) to allow content to be written to it.

Have you used the log successfullyt?
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: PHP/PEAR mail error

Post by Kieran Huggins »

http://www.swiftmailer.org/wikidocs/v3/misc/logging wrote:To get data back out of the log:

Code: Select all

$log =& Swift_LogContainer::getLog();
echo $log->dump(true);
Post Reply