2014-02-01 2 views
0

Я использую phpMailer для отправки массовой электронной почты. Некоторые из сообщений электронной почты подпрыгивают, как я получаю жесткие идентификаторы электронной почты.Ответ - SMTP-почтовая программа - phpMailer

Я новичок в PHP, я нашел в некоторых веб-сайтах я буду получать ответы, как

500 - The server could not recognize the command due to a syntax error. 
501 - A syntax error was encountered in command arguments. 
502 - This command is not implemented. 
503 - The server has encountered a bad sequence of commands. 
504 - A command parameter is not implemented. 

550 - The requested command failed because the user's mailbox was unavailable (for example because it was not found, or because the command was rejected for policy reasons). 
551 - The recipient is not local to the server. The server then gives a forward address to try. 
552 - The action was aborted due to exceeded storage allocation. 
553 - The command was aborted because the mailbox name is invalid. 
554 - The transaction failed. Blame it on the weather. 

но я не кладезь где-либо, как я получаю этот ответ?

ответ

1

При запуске "Send()" метод, вы можете проверить свойство "ErrorInfo":

$mail = new PHPMailer(); 
... 
if(!$mail->Send()) 
{ 
    echo "Message could not be sent."; 
    echo "Mailer Error: " . $mail->ErrorInfo; 
    exit; 
} 
echo "Message has been sent"; 

или

$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch 
... 
try 
{ 
    ... 
    $mail->Send(); 
} 
catch (phpmailerException $e) 
{ 
    echo $e->errorMessage(); // Error messages from PHPMailer 
} 
catch (Exception $e) 
{ 
    echo $e->getMessage();  // Something else 
} 
Смежные вопросы