I have recently learned about this mailing system called PHPMailer and I started testing it out.
Initially, I did the testing locally on localhost (using the free MAMP server) and everything worked perfectly fine. Then I uploaded my contents onto my website, only to realise that it did not work online.
Below is the debugging report with $mail->SMTPDebug = 2;
:
SERVER -> CLIENT: 220-a2plcpnl0392.prod.iad2.secureserver.net ESMTP Exim 4.85 #2 Thu, 28 Jan 2016 00:03:50 -0700 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
CLIENT -> SERVER: EHLO test.naitsabes.com
SERVER -> CLIENT: 250-a2plcpnl0392.prod.iad2.secureserver.net Hello a2plcpnl0392.prod.iad2.secureserver.net [198.71.231.68]250-SIZE 52428800250-8BITMIME250-PIPELINING250-AUTH PLAIN LOGIN250-STARTTLS250 HELP
CLIENT -> SERVER: STARTTLS
SERVER -> CLIENT: 220 TLS go ahead
CLIENT -> SERVER: EHLO test.naitsabes.com
SERVER -> CLIENT: 250-a2plcpnl0392.prod.iad2.secureserver.net Hello a2plcpnl0392.prod.iad2.secureserver.net [198.71.231.68]250-SIZE 52428800250-8BITMIME250-PIPELINING250-AUTH PLAIN LOGIN250 HELP
CLIENT -> SERVER: AUTH LOGIN
SERVER -> CLIENT: 334 xxx
CLIENT -> SERVER: ZGxldW5nQGNvbm5lY3Qua2VsbGV0dHNjaG9vbC5jb20=
SERVER -> CLIENT: 334 xxx
CLIENT -> SERVER: OTYxYmVlcGJlZXAxNjk=
SERVER -> CLIENT: 535 Incorrect authentication data
SMTP ERROR: Password command failed: 535 Incorrect authentication data
SMTP Error: Could not authenticate.
CLIENT -> SERVER: QUIT
SERVER -> CLIENT: 221 a2plcpnl0392.prod.iad2.secureserver.net closing connection
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
It seems to me that Gmail says the password is incorrect or something (but what do I know, this is the first time I used PHPMailer), but I'm not sure what exactly has gone wrong as the PHP code in my local server is perfectly identical which means the password should be correct.
In case this helps, my faulty (???) code is located at http://test.naitsabes.com but it is password protected to avoid people spamming my Gmail inbox. However, if it helps to enter the protected area for debugging purposes, there is a temporary login account with both username and password set to visitor
.
I will also provide the link to my source code (on GitHub) upon request but I won't do so on this post to avoid being misunderstood as spamming external links.
Thank you, and much help will be appreciated :)
P.S. I know this question has been posted once by someone else already but by the looks of it, the (original) question is still unsolved with not a single answer.