Stuck with PHPMailer – SMTP error password command failed? We can help you.
We may come across this error when we try to send mail using phpmailer().
SMTP ERROR: Password command failed: 534-5.7.14
As part of our Server Management Services, we assist our customers with several SMTP queries.
Today, let us see how to fix this error.
PHPMailer – SMTP error password command failed
This error may occur due to the below reasons:
- When a less secure application tries to use the email account.
- If we try to log in several times a row
- If we change countries (For example, use VPN, move code to a different server, or actually try to login from a different part of the world).
Moving ahead, let us see the methods our Support Techs employ in order to fix this.
Solution 1: In the case of the Windows server
PHP.ini
- Initially, we go to C:\xampp\php, edit the php.ini file with notepad.
- Under the [mail munction] section, we remove the semicolon for this line:
sendmail_path = “\”C:\xampp\sendmail\sendmail.exe\” -t”
- Then we add a semicolon for this line:
sendmail_path=”C:\xampp\mailtodisk\mailtodisk.exe”
SendMail.ini
- Here, we go to C:\xampp\sendmail, edit the sendmail.ini file with notepad
- Then we change the following:
smtp_server=smtp.gmail.com smtp_port=465 auth_username=your-gmail-username@gmail.com auth_password=your-gmail-password force_sender=your-gmail-username@gmail.com
smtp_port should tally with what is written in our php code.
Solution 2: Enable less secure applications (SMTP server is Gmail)
- Initially, we login to the account via web
- Then we view recent attempts to use the account and accept suspicious access:
https://security.google.com/settings/security/activity?hl=en&pli=1 - We can disable the feature of blocking suspicious apps/technologies:
https://www.google.com/settings/u/1/security/lesssecureapps
Solution 3: (SMTP server is Gmail)
- Initially, login to the account via web
- Access the URL: https://accounts.google.com/b/0/DisplayUnlockCaptcha
- Then we click the continue option
- We can check whether phpmailer is set as SMTP with SSL.
This will work if our SMTP server is Gmail.
Solution 4: Change SMTPSecure value from SSL to TLS in phpmailer() code.
Solution 5: In the case of Gsuite
In such a case, we have to solve it as the Administrator.
- Go to Admin panel >> Security with Shield icon >> Basic settings
- Then go to the Less secure apps section
- Now we select one of the Radio Button:
a) Disable access to less secure apps for all users (Recommended)
b) Allow users to manage their access to less secure apps
c) Enforce access to less secure apps for all users (Not Recommended)
Generally, if option a) does not work, it will start to work with the c) option.
Solution 6: In the case of cPanel/WHM servers
This is related to a security feature in WHM/cPanel.
- Firstly, log in to CPanel
- Navigate to Tweak Settings > All > “Restrict outgoing SMTP to root, Exim, and mailman”
- Eventually, switch it from “On” to “Off”.
In addition, we can do this via SSH as well:
/scripts/smtpmailgidonly off
[Need help with the solution? We’d be happy to assist]
Conclusion
In short, today, we saw how our Support techs resolve the SMTP error.
0 Comments