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 ---------------------
>     for ( $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,

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 Lemos


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to