响应-SMTP邮件程序-phpMailer

响应-SMTP邮件程序-phpMailer,smtp,Smtp,我正在使用phpMailer发送批量电子邮件,一些电子邮件正在跳转,我如何获得硬跳转的电子邮件ID 我是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 - T

我正在使用phpMailer发送批量电子邮件,一些电子邮件正在跳转,我如何获得硬跳转的电子邮件ID

我是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. 
但是我不知道如何得到这个响应?

当您运行“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
}