I recently started working on a new website on a new development server that I recently purchased & despite using the exact same PHPMailer code that I use on all of my other sites, I just couldn’t get any mail to send.
I enabled debugging in PHPMailer & found that it was an authentication issue. I was getting “Password command failed“.
Naturally, I thought it was a problem with my credentials & so after resetting my details several times & discovering it still wasn’t working, I found myself scratching my head wondering what it could be.
Thankfully, after doing some digging I finally found out that it was a cPanel issue & that I needed to make a change in Tweak settings, because by default only certain users can send mail via SMTP.
So if you’ve found yourself faced with the same issue, to fix it just log into WHM & configure the following setting:
Tweak Settings > All> “Restrict outgoing SMTP to root, exim, and mailman (FKA SMTP Tweak) and switch it from “On” to “Off”.
You should find that your mail sends fine after that.