I came across a weired issue recently. it took three,four hours to resolve it.
I was using PHPMailer to send emails and everything worked fine when i tested from my machine. Then , when i uploaded to a sever and tested the mails do not go out. and i when enabled debug i saw errors like the following.
Please note that i have replaced the actual sever IP with {IP}
$data is "554-{IP} has not been authenticated to relay mail 554 Connect to your mailbox before sending mail via this relay " SMTP -> FROM SERVER: 554-{IP} has not been authenticated to relay mail 554 Connect to your mailbox before sending mail via this relay SMTP -> FROM SERVER: SMTP -> ERROR: EHLO not accepted from server: SMTP -> FROM SERVER: SMTP -> ERROR: HELO not accepted from server: {email}SMTP -> NOTICE: EOF caught while checking if connected
and i was confused for a long time , since the same code runs perfectly on my machine. How ever , part of the error message "Connect to your mailbox before sending mail" rang a bell. I had heard of POP before SMTP authentication ,though i always used direct SMTP authentication.
On further investigation i realized that my host uses POP before SMTP authentication. Then how come that the same code ran in my laptop?
Simply because i had checked emails from the laptop, before i tested that code. and POP before SMTP authentication allows relaying of emails for about 90 mins for that IP, from the time you successfully connected to check email.
Having identified the issue , i quickly found code that would allow me to perform POP before SMTP authentication (PHPMailer does not support this mode). Thanks to Richard for publishing that code under LGPL license.
http://www.corephp.co.uk/archives/18-POP-before-SMTP-Authentication-for-PHPMailer.html
what that code does is, it allows your code to login to the POP server and By logging in to POP, you verify that you are authorized to use the SMTP service. It opens up facility hole that allows you to send SMTP mail for a short period
note that it is not required to READ your e-mail, you just have to log in. Pair Networks does use this mechanism.
