php - How to Check for PEAR Mail SMTP Authentication Failure -
i'm constructing smtp e-mail framework have default username , password sending e-mails (using php's pear mail), want have functionality provide alternate e-mail account credentials sending e-mail.
so, debugging need able determine why e-mail unable sent. know of easy determine failure due authentication issue?
i ran test case invalid password. check errors:
if (pear::iserror($mail)) { echo("<p>" . $mail->getmessage() . "</p>"); } else { echo("<p>message sent!</p>"); }
with error message being:
authentication failure [smtp: invalid response code received server (code: 535, response: 5.7.3 authentication unsuccessful)]
so, parse string , determine "authentication failure", if i'm confident response when there authentication failure. question is, can expect message returned if there authentication failure, or know of easier solution verifying login credentials before or after attempting send e-mail?
a pear_error object has - among others - methods error code , message separately:
in mail package case, error code smtp error code, documented in rfc 5321.
Comments
Post a Comment