Re: how to debug mail() problem?
| From: | Manuel Lemos | Date: | Tue, 30 Jul 2002 16:36:04 +0000 |
| Subject: | Re: how to debug mail() problem? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-110368@lists.php.net to get a copy of this message | ||
On 07/30/2002 01:27 PM, Kevin Porter wrote:
Hi, I have a loop that sends out a numbers of emails using the mail() function. -- Code start ---------------------Mail() has a track record of being very buggy, especially under Windows. From that error message it seems that it is getting an unexpected response from your server on the QUIT SMTP command. Anyway, if all else fails, you may want to try to use this class: http://www.phpclasses.org/smtpclass maybe in conjunction with this http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemosfor ( $i=0, $j=count($responders); $i < $j; $i++ ) { $r = $responders[$i];$headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";$headers .= "From: $r->FirstName $r->LastName <$r->Email>\r\n";echo "sending email to $r->FirstName $r->LastName ($r->Email)<br>";if ( !mail( $r->Email, "Subject", $message, $headers ) ) echo "Failed to send email to $r->FirstName $r->LastName($r->Email)<br>";}-- Code end ---------------------- $responders is an array of Responder objects - a Responder object has Email, LastName, FirstName member variables. My problem is that although the email is sent on each iteration and reaches it's intended recipient, I get the "Failed to send email ...." message on every loop! Anyone know why? mail() is obviously returning false, but the manual says "mail() returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise". Yet it _must_ have been successfully accepted for delivery, because the emails always get delivered. Any help would be appreciated. thanks,