1

It's possible? Get response code from smtp.com using phpmailer. I have the list of codes smtp.com, but using the variable $mail->ErrorInfo only get a description of error, I like get the code:

http://www.answersthatwork.com/Download_Area/ATW_Library/Networking/Network__3-SMTP_Server_Status_Codes_and_SMTP_Error_Codes.pdf

Thanks

  • `phpmailer` throws a `phpmailerException` in case of an error. Did you take a look into that object? – arkascha Feb 02 '16 at 16:57
  • Yes, I look into object, but not have the smtp error code, this is a example:phpmailerException Object ( [message:protected] => SMTP Error: Could not authenticate. [string:Exception:private] => [code:protected] => 0 – Jonathan Cordero Duarte Feb 02 '16 at 17:54

1 Answers1

1

You can get the last SMTP error by calling $mail->getSMTPInstance()->getError();. It returns a structure like this:

[
    'error' => '',
    'detail' => '',
    'smtp_code' => '',
    'smtp_code_ex' => ''
]

The value you are looking for will be in the smtp_code property.

Synchro
  • 35,538
  • 15
  • 81
  • 104