While connecting your email account through the SMTP method, you may encounter SMTP Error: Could not authenticate error. SMTP connection can't be established If you have
turned on the 2-factor authentication for your email account so you either need to turn it off or generate an app password for your email account. That app password can be used in your SalesHandy account to connect the email account via SMTP method. Many email providers allow users to generate an app-specific password and every email service provider has different methods of creating app passwords. Please follow the below articles to know the steps of generating app passwords
[Application-Specific Passwords] as per your email provider. Please note that you need to use the generated password while connecting your email account with SalesHandy. Although it happens rarely, sometimes, the
email providers keep the SMTP connection disabled so it can't be connected via the SMTP method. In that case, users are requested to reach out to their email service provider to get SMTP enabled. 1. You might have entered the wrong email credentials.
2. You might have the wrong SMTP settings.
3. Your email account has multi-factor authentication enabled:
4. The SMTP connection is disabled by your email service provider.
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.
Still need help? Contact Us Contact Us
Last updated on July 27, 2022I want to send emails in Gmail using PHP Mailer in a Simple Script but I am getting an error:
SMTP Error: Could not authenticate. Error: SMTP Error: Could not authenticate. SMTP server error: 5.7.1 Username and Password not accepted. Learn more at 535 5.7.1 //mail.google.com/support/bin/answer.py?answer=14257 p38sm2467302ybk.16
I configured the OpenSSL For SSL/TLS Connections.
This is my PHP Script:
Can someone help me solve this issue?
Please check these things before submitting your issue:
- Make sure you're using the latest version of PHPMailer
- Check that your problem is not dealt with in the troubleshooting guide, especially if you're having problems connecting to Gmail or GoDaddy
- Include sufficient code to reproduce your problem
- If you're having an SMTP
issue, include the debug output generated with
SMTPDebug = 2
set - If you have a question about how to use PHPMailer [rather than reporting a bug in it], tag a question on Stack Overflow with
phpmailer
, but search first!
Problem description
When i trying send message from smtp.gmail.com, with ssl, or tls, or different ports, doesnt matter,
it's throw exception to me.
I have Allowed less secure apps in gmail, and i visit captcha confirmation
Code to reproduce
$mail->isSMTP[]; $mail->SMTPDebug = 2; $mail->Host = "smtp.gmail.com"; $mail->SMTPAuth = true; $mail->SMTPSecure = "ssl"; $mail->Port = 465; $mail->CharSet = "UTF-8"; $mail->Username = ""; $mail->Password = "*******"; $mail->setFrom["", "Alex"]; $mail->Subject = "Тест, отправка письма"; $mail->msgHTML["Message"]; $mail->addAddress[""]; if [!$mail->send[]] { $mail->ErrorInfo; } else { echo "123"; }
Debug output
2017-10-23 19:44:18 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP q24sm1694776lff.48 - gsmtp
2017-10-23 19:44:18 CLIENT -> SERVER: EHLO *my_server*
2017-10-23 19:44:18 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [*my_server*]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
2017-10-23 19:44:18 CLIENT -> SERVER: AUTH LOGIN
2017-10-23 19:44:18 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2017-10-23 19:44:18 CLIENT -> SERVER: YXJldm9sdXRpb25wcm9qZWN0QGdtYWlsLmNvbQ==
2017-10-23 19:44:18 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2017-10-23 19:44:18 CLIENT -> SERVER: cmV2b2x1dGlvbjEyMw==
2017-10-23 19:44:18 SERVER -> CLIENT: 534-5.7.14 Please log in via your web browser and534-5.7.14 then try again.534-5.7.14 Learn more at534 5.7.14 //support.google.com/mail/answer/78754 q24sm1694776lff.48 - gsmtp
2017-10-23 19:44:18 SMTP ERROR: Password command failed: 534-5.7.14 Please log in via your web browser and534-5.7.14 then try again.534-5.7.14 Learn more at534 5.7.14 //support.google.com/mail/answer/78754 q24sm1694776lff.48 - gsmtp
SMTP Error: Could not authenticate.
2017-10-23 19:44:18 CLIENT -> SERVER: QUIT
2017-10-23 19:44:19 SERVER -> CLIENT: 221 2.0.0 closing connection q24sm1694776lff.48 - gsmtp
SMTP Error: Could not authenticate.