Reputation: 1
I am using phpMailer for sending bulk email, Some of emails are bouncing, How I get Hard Bounced email ids.
I am new in PHP, I found in some websites i will get responses like
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.
but I didnt fount any where how I get this response?
Upvotes: 0
Views: 1800
Reputation: 448
When you run "Send()" method you may check "ErrorInfo" property:
$mail = new PHPMailer();
...
if(!$mail->Send())
{
echo "Message could not be sent.";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
or
$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
}
Upvotes: 1