I have a script that seemed to work before but no longer does.
It is displaying this message after the script runs:
Array ( [0] => Unrouteable address [1] => -All RCPT commands were rejected with this error: 503-Unrouteable address 503 valid RCPT command must precede DATA ) Array ( [0] => Unrouteable address [1] => -All RCPT commands were rejected with this error: 503-Unrouteable address 503 valid RCPT command must precede DATA ) Array ( [0] => Unrouteable address [1] => -All RCPT commands were rejected with this error: 503-Unrouteable address 503 valid RCPT command must precede DATA )
function emailUser($table, $subject, $message) {
$query = "SELECT * FROM $table";
$result=mysql_query($query);
while($row = mysql_fetch_array($result)) {
$i = 0;
while($i <= 0) {
$to = $row['email'];
$to_all .= '<li>'.$row['email'].'</li>';
$mail = new htmlMimeMail();
$mail->setHTML($message);
$mail->setSubject($subject);
$mail->setSMTPParams('mail.site.net', 25, 'site.net');
$mail->setReturnPath("[email protected]");
$mail->setFrom("[email protected]");
$mail_result = $mail->send(array($to), 'smtp');
if (!$mail_result) {
print_r($mail->errors);
//failure
} else {
//success
}
$i++;
}
}
print '<h3>Mail successuly sent to:</h3>';
print '<ul>'.$to_all.'</ul>';
}
Is there a better script to use? Maybe the email server has changed?
Any help is appreciated.