I’m using PHPMailer in a Simple Script For Send Email’s Through Gmail, and I’m getting an «Unknown Error» (At least for me!):
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
http://mail.google.com/support/bin/answer.py?answer=14257
p38sm2467302ybk.16
I’ve read about Configure OpenSSL For SSL/TLS Connections, and I did it. Apache And PHP Are properly-Configured (With OpenSSL extension Running in PHP and mod_ssl running in Apache 2.2.16).
This is The PHP Script:
<?php
require_once ("PHPMailerclass.phpmailer.php");
$Correo = new PHPMailer();
$Correo->IsSMTP();
$Correo->SMTPAuth = true;
$Correo->SMTPSecure = "tls";
$Correo->Host = "smtp.gmail.com";
$Correo->Port = 587;
$Correo->UserName = "foo@gmail.com";
$Correo->Password = "gmailpassword";
$Correo->SetFrom('foo@gmail.com','De Yo');
$Correo->FromName = "From";
$Correo->AddAddress("bar@hotmail.com");
$Correo->Subject = "Prueba con PHPMailer";
$Correo->Body = "<H3>Bienvenido! Esto Funciona!</H3>";
$Correo->IsHTML (true);
if (!$Correo->Send())
{
echo "Error: $Correo->ErrorInfo";
}
else
{
echo "Message Sent!";
}
?>
The Username and Password are OK, And I tried in Thunderbird, without any problem.
I’ve also Used SSL Authentication and Port 465, getting the same Error.
Cœur
36.3k25 gold badges191 silver badges258 bronze badges
asked Oct 16, 2010 at 16:57
![]()
2
I encountered this problem. To get it working, I had to go to myaccount.google.com -> «Sign-in & security» -> «Apps with account access», and turn «Allow less secure apps» to «ON» (near the bottom of the page).
Alternatively you can follow this direct link to these settings

![]()
Joundill
6,41211 gold badges35 silver badges50 bronze badges
answered Sep 4, 2015 at 14:56
7
Try this instead :
$Correo->Username = «foo@gmail.com»;
I tested it and its working perfectly without no other change
answered Oct 16, 2010 at 17:19
![]()
malletjomalletjo
1,78616 silver badges18 bronze badges
2
I received the same error and in mycase it was the password. My password has special characters.
If you supply the password without escaping the special characters the error will persist.
E.g $mail->Password = " por$ch3"; is valid but will not work using the code above .
The solution should be as follows: $mail->Password = "por$ch3";
Note the Backslash I placed before the dollar character within my password.
That should work if you have a password using special characters
answered Aug 1, 2012 at 9:57
BubbaBubba
1011 silver badge7 bronze badges
2
I experienced the same error when configuring the WP-Mail-SMTP plugin in WordPress.
The problem would persist even when I have ‘triple checked’ the settings and login credentials, and am able to log in manually using a browser.
There’s a list of steps you can take to fix this.
- Create a new password for the Gmail account you want to use
- Enable less secure apps in Google Security settings
- Use the
Display Unlock Captchapage to give your app or website permission to sign in to Gmail. ClickContinueor follow the instructions. - Sign in using the app or website. The smtp settings that work for me are 1) SMTP Host: smtp.gmail.com 2) SMTP port: 587 3) Encryption: TLS 4) Authentication: SMTP authentication 5) Username: example@gmail.com 6) Password: examplesecret
![]()
Greg
20.8k17 gold badges81 silver badges106 bronze badges
answered Jul 20, 2017 at 8:24
pyforkpyfork
3,5972 gold badges20 silver badges18 bronze badges
1
my solution is:
- change gmail password
- on gmail «Manage your google Account» > Security > Turn on 3rd party app Access
- This the new step that i discover by UnlockingCaptcha that told in this site, the exact site is https://accounts.google.com/b/0/DisplayUnlockCaptcha, but maybe you want to read the former site first.
That all, hope it works for you
answered Jul 15, 2020 at 15:37
1
Because Allow less secure apps is no longer available

The solution was to enable 2-step verification and generate app password

select mail and computer from the list then click generate
copy the code shown in the box and replace your google password with your app password it works like a charm.

answered Jun 28, 2022 at 2:10
![]()
Kym NTKym NT
6109 silver badges28 bronze badges
1
I received this error because of percentage signs in the password.
answered Dec 5, 2011 at 13:22
![]()
svandragtsvandragt
1,61320 silver badges37 bronze badges
1
For me I had a special characters in my password field, and I put it like $mail->Password = » por$ch3″ which work for gmail smpt server but not for other; so I just changed double quotes to single quotes and it works for me. $mail->Password = ‘ por$ch3’;
answered Jun 11, 2013 at 12:17
![]()
3
If you still face error in sending email, with the same error message. Try this:
$mail->SMTPSecure = 'tls';
$mail->Host = 'smtp.gmail.com';
just Before the line:
$send = $mail->Send();
or in other sense, before calling the Send() Function.
Tested and Working.
answered Jun 11, 2014 at 19:30
JackSparrowJackSparrow
9081 gold badge11 silver badges8 bronze badges
1
The other post is correct to resolve the issue but doesn’t address how to do it if the 2-step-verification is turned on. The option to allow the less secure apps is NOT available then. Here is an answer to how to do it:
a. Go to the URL of `https://myaccount.google.com/` and click `Sing-in and security`
b. Click on the app password.
You will reach a page like this,

c. Create name of your app and generate a password for the respective app.
d. Use that password acquired here inside the app.
This should resolve the issue.
answered May 20, 2018 at 10:16
![]()
ArefeArefe
10.4k16 gold badges101 silver badges159 bronze badges
0
I had the same issue and did all the tips including Gmail setting (e.g. less secure apps access) with no luck. But finally when I changed password to something different, for some reason it worked! FYI, the initial password did not have any special characters.
answered May 24, 2016 at 22:57
EhsanEhsan
1,02211 silver badges20 bronze badges
- first go to https://myaccount.google.com
- Select Security tab
- Scroll down and select ‘Less secure app access’
- Turn on access
This will solve my “SMTP Error: Could not authenticate” in PHPMailer error.
answered Apr 29, 2020 at 13:07
ruwanmadhusankaruwanmadhusanka
7812 gold badges7 silver badges15 bronze badges
I had the same issue and did all the tips with no luck. Finally when I changed password to something different, for some reason it worked! (the initial password or the new one did not have any special characters)
answered Aug 18, 2019 at 14:06
0
The correct answer:
Go to «Manage your google accounts => Security => Signing in to Google => App passwords».
Generate your maill account password there (that will be used from other device)
answered Apr 13, 2022 at 9:49
I had the same problem with authentication. The fix was to set up 2-step verification and create an application specific password for the device ( error messages for blocking the device will appear in your account settings->»Notifications and alerts» if you problem is the same with mine)
answered Jan 29, 2015 at 21:35
It was the selinux issue. I just updated the below given part in /etc/selinux/config file
SELINUX=permissive (it was SELINUX=enforcing before).
then just reboot the system by giving
reboot
Now the mail goes without any hassle.
Configuration
From Email Address : [noreply@yourdomain.com]
From Name : [your domain name]
SMTP Host : smtp.gmail.com
Type of Encryption : SSL
SMTP Port : 465
SMTP Authentication : YES
Username : [your mail id]
Password : [your password]
answered Feb 10, 2016 at 7:17
SMTP Error: could not authenticate
I had the same problem. The following troubleshooting steps helped me.
- I turned off two-factor authentication in my gmail account.
- I allowed less secure apps to access my gmail account. To get it working, I had to go to
myaccount.google.com->Sign-in & security->Apps with account access, and turnAllow less secure appstoON(near the bottom of the page). - At this step, when I tried to register a user, I would get the same error. Google would sent me a warning message that someone has my password and the login was blocked.
- Gmail will then provide you with options. You either click whether the activity was yours or not yours. Click the option that the activity was yours.
- Try registration again. It should now work.
![]()
cSteusloff
2,4376 gold badges27 silver badges50 bronze badges
answered Dec 14, 2017 at 11:47
There is no issue with your code.
Follow below two simple steps to send emails from phpmailer.
You have to disable 2-step verification setting for google account if you have enabled.
Turn ON allow access to less secure app.
answered Apr 12, 2018 at 7:24
![]()
I’m using PHPMailer in a Simple Script For Send Email’s Through Gmail, and I’m getting an «Unknown Error» (At least for me!):
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
http://mail.google.com/support/bin/answer.py?answer=14257
p38sm2467302ybk.16
I’ve read about Configure OpenSSL For SSL/TLS Connections, and I did it. Apache And PHP Are properly-Configured (With OpenSSL extension Running in PHP and mod_ssl running in Apache 2.2.16).
This is The PHP Script:
<?php
require_once ("PHPMailerclass.phpmailer.php");
$Correo = new PHPMailer();
$Correo->IsSMTP();
$Correo->SMTPAuth = true;
$Correo->SMTPSecure = "tls";
$Correo->Host = "smtp.gmail.com";
$Correo->Port = 587;
$Correo->UserName = "foo@gmail.com";
$Correo->Password = "gmailpassword";
$Correo->SetFrom('foo@gmail.com','De Yo');
$Correo->FromName = "From";
$Correo->AddAddress("bar@hotmail.com");
$Correo->Subject = "Prueba con PHPMailer";
$Correo->Body = "<H3>Bienvenido! Esto Funciona!</H3>";
$Correo->IsHTML (true);
if (!$Correo->Send())
{
echo "Error: $Correo->ErrorInfo";
}
else
{
echo "Message Sent!";
}
?>
The Username and Password are OK, And I tried in Thunderbird, without any problem.
I’ve also Used SSL Authentication and Port 465, getting the same Error.
Cœur
36.3k25 gold badges191 silver badges258 bronze badges
asked Oct 16, 2010 at 16:57
![]()
2
I encountered this problem. To get it working, I had to go to myaccount.google.com -> «Sign-in & security» -> «Apps with account access», and turn «Allow less secure apps» to «ON» (near the bottom of the page).
Alternatively you can follow this direct link to these settings

![]()
Joundill
6,41211 gold badges35 silver badges50 bronze badges
answered Sep 4, 2015 at 14:56
7
Try this instead :
$Correo->Username = «foo@gmail.com»;
I tested it and its working perfectly without no other change
answered Oct 16, 2010 at 17:19
![]()
malletjomalletjo
1,78616 silver badges18 bronze badges
2
I received the same error and in mycase it was the password. My password has special characters.
If you supply the password without escaping the special characters the error will persist.
E.g $mail->Password = " por$ch3"; is valid but will not work using the code above .
The solution should be as follows: $mail->Password = "por$ch3";
Note the Backslash I placed before the dollar character within my password.
That should work if you have a password using special characters
answered Aug 1, 2012 at 9:57
BubbaBubba
1011 silver badge7 bronze badges
2
I experienced the same error when configuring the WP-Mail-SMTP plugin in WordPress.
The problem would persist even when I have ‘triple checked’ the settings and login credentials, and am able to log in manually using a browser.
There’s a list of steps you can take to fix this.
- Create a new password for the Gmail account you want to use
- Enable less secure apps in Google Security settings
- Use the
Display Unlock Captchapage to give your app or website permission to sign in to Gmail. ClickContinueor follow the instructions. - Sign in using the app or website. The smtp settings that work for me are 1) SMTP Host: smtp.gmail.com 2) SMTP port: 587 3) Encryption: TLS 4) Authentication: SMTP authentication 5) Username: example@gmail.com 6) Password: examplesecret
![]()
Greg
20.8k17 gold badges81 silver badges106 bronze badges
answered Jul 20, 2017 at 8:24
pyforkpyfork
3,5972 gold badges20 silver badges18 bronze badges
1
my solution is:
- change gmail password
- on gmail «Manage your google Account» > Security > Turn on 3rd party app Access
- This the new step that i discover by UnlockingCaptcha that told in this site, the exact site is https://accounts.google.com/b/0/DisplayUnlockCaptcha, but maybe you want to read the former site first.
That all, hope it works for you
answered Jul 15, 2020 at 15:37
1
Because Allow less secure apps is no longer available

The solution was to enable 2-step verification and generate app password

select mail and computer from the list then click generate
copy the code shown in the box and replace your google password with your app password it works like a charm.

answered Jun 28, 2022 at 2:10
![]()
Kym NTKym NT
6109 silver badges28 bronze badges
1
I received this error because of percentage signs in the password.
answered Dec 5, 2011 at 13:22
![]()
svandragtsvandragt
1,61320 silver badges37 bronze badges
1
For me I had a special characters in my password field, and I put it like $mail->Password = » por$ch3″ which work for gmail smpt server but not for other; so I just changed double quotes to single quotes and it works for me. $mail->Password = ‘ por$ch3’;
answered Jun 11, 2013 at 12:17
![]()
3
If you still face error in sending email, with the same error message. Try this:
$mail->SMTPSecure = 'tls';
$mail->Host = 'smtp.gmail.com';
just Before the line:
$send = $mail->Send();
or in other sense, before calling the Send() Function.
Tested and Working.
answered Jun 11, 2014 at 19:30
JackSparrowJackSparrow
9081 gold badge11 silver badges8 bronze badges
1
The other post is correct to resolve the issue but doesn’t address how to do it if the 2-step-verification is turned on. The option to allow the less secure apps is NOT available then. Here is an answer to how to do it:
a. Go to the URL of `https://myaccount.google.com/` and click `Sing-in and security`
b. Click on the app password.
You will reach a page like this,

c. Create name of your app and generate a password for the respective app.
d. Use that password acquired here inside the app.
This should resolve the issue.
answered May 20, 2018 at 10:16
![]()
ArefeArefe
10.4k16 gold badges101 silver badges159 bronze badges
0
I had the same issue and did all the tips including Gmail setting (e.g. less secure apps access) with no luck. But finally when I changed password to something different, for some reason it worked! FYI, the initial password did not have any special characters.
answered May 24, 2016 at 22:57
EhsanEhsan
1,02211 silver badges20 bronze badges
- first go to https://myaccount.google.com
- Select Security tab
- Scroll down and select ‘Less secure app access’
- Turn on access
This will solve my “SMTP Error: Could not authenticate” in PHPMailer error.
answered Apr 29, 2020 at 13:07
ruwanmadhusankaruwanmadhusanka
7812 gold badges7 silver badges15 bronze badges
I had the same issue and did all the tips with no luck. Finally when I changed password to something different, for some reason it worked! (the initial password or the new one did not have any special characters)
answered Aug 18, 2019 at 14:06
0
The correct answer:
Go to «Manage your google accounts => Security => Signing in to Google => App passwords».
Generate your maill account password there (that will be used from other device)
answered Apr 13, 2022 at 9:49
I had the same problem with authentication. The fix was to set up 2-step verification and create an application specific password for the device ( error messages for blocking the device will appear in your account settings->»Notifications and alerts» if you problem is the same with mine)
answered Jan 29, 2015 at 21:35
It was the selinux issue. I just updated the below given part in /etc/selinux/config file
SELINUX=permissive (it was SELINUX=enforcing before).
then just reboot the system by giving
reboot
Now the mail goes without any hassle.
Configuration
From Email Address : [noreply@yourdomain.com]
From Name : [your domain name]
SMTP Host : smtp.gmail.com
Type of Encryption : SSL
SMTP Port : 465
SMTP Authentication : YES
Username : [your mail id]
Password : [your password]
answered Feb 10, 2016 at 7:17
SMTP Error: could not authenticate
I had the same problem. The following troubleshooting steps helped me.
- I turned off two-factor authentication in my gmail account.
- I allowed less secure apps to access my gmail account. To get it working, I had to go to
myaccount.google.com->Sign-in & security->Apps with account access, and turnAllow less secure appstoON(near the bottom of the page). - At this step, when I tried to register a user, I would get the same error. Google would sent me a warning message that someone has my password and the login was blocked.
- Gmail will then provide you with options. You either click whether the activity was yours or not yours. Click the option that the activity was yours.
- Try registration again. It should now work.
![]()
cSteusloff
2,4376 gold badges27 silver badges50 bronze badges
answered Dec 14, 2017 at 11:47
There is no issue with your code.
Follow below two simple steps to send emails from phpmailer.
You have to disable 2-step verification setting for google account if you have enabled.
Turn ON allow access to less secure app.
answered Apr 12, 2018 at 7:24
![]()
I’m using PHPMailer in a Simple Script For Send Email’s Through Gmail, and I’m getting an «Unknown Error» (At least for me!):
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
http://mail.google.com/support/bin/answer.py?answer=14257
p38sm2467302ybk.16
I’ve read about Configure OpenSSL For SSL/TLS Connections, and I did it. Apache And PHP Are properly-Configured (With OpenSSL extension Running in PHP and mod_ssl running in Apache 2.2.16).
This is The PHP Script:
<?php
require_once ("PHPMailerclass.phpmailer.php");
$Correo = new PHPMailer();
$Correo->IsSMTP();
$Correo->SMTPAuth = true;
$Correo->SMTPSecure = "tls";
$Correo->Host = "smtp.gmail.com";
$Correo->Port = 587;
$Correo->UserName = "foo@gmail.com";
$Correo->Password = "gmailpassword";
$Correo->SetFrom('foo@gmail.com','De Yo');
$Correo->FromName = "From";
$Correo->AddAddress("bar@hotmail.com");
$Correo->Subject = "Prueba con PHPMailer";
$Correo->Body = "<H3>Bienvenido! Esto Funciona!</H3>";
$Correo->IsHTML (true);
if (!$Correo->Send())
{
echo "Error: $Correo->ErrorInfo";
}
else
{
echo "Message Sent!";
}
?>
The Username and Password are OK, And I tried in Thunderbird, without any problem.
I’ve also Used SSL Authentication and Port 465, getting the same Error.
Cœur
36.3k25 gold badges191 silver badges258 bronze badges
asked Oct 16, 2010 at 16:57
![]()
2
I encountered this problem. To get it working, I had to go to myaccount.google.com -> «Sign-in & security» -> «Apps with account access», and turn «Allow less secure apps» to «ON» (near the bottom of the page).
Alternatively you can follow this direct link to these settings

![]()
Joundill
6,41211 gold badges35 silver badges50 bronze badges
answered Sep 4, 2015 at 14:56
7
Try this instead :
$Correo->Username = «foo@gmail.com»;
I tested it and its working perfectly without no other change
answered Oct 16, 2010 at 17:19
![]()
malletjomalletjo
1,78616 silver badges18 bronze badges
2
I received the same error and in mycase it was the password. My password has special characters.
If you supply the password without escaping the special characters the error will persist.
E.g $mail->Password = " por$ch3"; is valid but will not work using the code above .
The solution should be as follows: $mail->Password = "por$ch3";
Note the Backslash I placed before the dollar character within my password.
That should work if you have a password using special characters
answered Aug 1, 2012 at 9:57
BubbaBubba
1011 silver badge7 bronze badges
2
I experienced the same error when configuring the WP-Mail-SMTP plugin in WordPress.
The problem would persist even when I have ‘triple checked’ the settings and login credentials, and am able to log in manually using a browser.
There’s a list of steps you can take to fix this.
- Create a new password for the Gmail account you want to use
- Enable less secure apps in Google Security settings
- Use the
Display Unlock Captchapage to give your app or website permission to sign in to Gmail. ClickContinueor follow the instructions. - Sign in using the app or website. The smtp settings that work for me are 1) SMTP Host: smtp.gmail.com 2) SMTP port: 587 3) Encryption: TLS 4) Authentication: SMTP authentication 5) Username: example@gmail.com 6) Password: examplesecret
![]()
Greg
20.8k17 gold badges81 silver badges106 bronze badges
answered Jul 20, 2017 at 8:24
pyforkpyfork
3,5972 gold badges20 silver badges18 bronze badges
1
my solution is:
- change gmail password
- on gmail «Manage your google Account» > Security > Turn on 3rd party app Access
- This the new step that i discover by UnlockingCaptcha that told in this site, the exact site is https://accounts.google.com/b/0/DisplayUnlockCaptcha, but maybe you want to read the former site first.
That all, hope it works for you
answered Jul 15, 2020 at 15:37
1
Because Allow less secure apps is no longer available

The solution was to enable 2-step verification and generate app password

select mail and computer from the list then click generate
copy the code shown in the box and replace your google password with your app password it works like a charm.

answered Jun 28, 2022 at 2:10
![]()
Kym NTKym NT
6109 silver badges28 bronze badges
1
I received this error because of percentage signs in the password.
answered Dec 5, 2011 at 13:22
![]()
svandragtsvandragt
1,61320 silver badges37 bronze badges
1
For me I had a special characters in my password field, and I put it like $mail->Password = » por$ch3″ which work for gmail smpt server but not for other; so I just changed double quotes to single quotes and it works for me. $mail->Password = ‘ por$ch3’;
answered Jun 11, 2013 at 12:17
![]()
3
If you still face error in sending email, with the same error message. Try this:
$mail->SMTPSecure = 'tls';
$mail->Host = 'smtp.gmail.com';
just Before the line:
$send = $mail->Send();
or in other sense, before calling the Send() Function.
Tested and Working.
answered Jun 11, 2014 at 19:30
JackSparrowJackSparrow
9081 gold badge11 silver badges8 bronze badges
1
The other post is correct to resolve the issue but doesn’t address how to do it if the 2-step-verification is turned on. The option to allow the less secure apps is NOT available then. Here is an answer to how to do it:
a. Go to the URL of `https://myaccount.google.com/` and click `Sing-in and security`
b. Click on the app password.
You will reach a page like this,

c. Create name of your app and generate a password for the respective app.
d. Use that password acquired here inside the app.
This should resolve the issue.
answered May 20, 2018 at 10:16
![]()
ArefeArefe
10.4k16 gold badges101 silver badges159 bronze badges
0
I had the same issue and did all the tips including Gmail setting (e.g. less secure apps access) with no luck. But finally when I changed password to something different, for some reason it worked! FYI, the initial password did not have any special characters.
answered May 24, 2016 at 22:57
EhsanEhsan
1,02211 silver badges20 bronze badges
- first go to https://myaccount.google.com
- Select Security tab
- Scroll down and select ‘Less secure app access’
- Turn on access
This will solve my “SMTP Error: Could not authenticate” in PHPMailer error.
answered Apr 29, 2020 at 13:07
ruwanmadhusankaruwanmadhusanka
7812 gold badges7 silver badges15 bronze badges
I had the same issue and did all the tips with no luck. Finally when I changed password to something different, for some reason it worked! (the initial password or the new one did not have any special characters)
answered Aug 18, 2019 at 14:06
0
The correct answer:
Go to «Manage your google accounts => Security => Signing in to Google => App passwords».
Generate your maill account password there (that will be used from other device)
answered Apr 13, 2022 at 9:49
I had the same problem with authentication. The fix was to set up 2-step verification and create an application specific password for the device ( error messages for blocking the device will appear in your account settings->»Notifications and alerts» if you problem is the same with mine)
answered Jan 29, 2015 at 21:35
It was the selinux issue. I just updated the below given part in /etc/selinux/config file
SELINUX=permissive (it was SELINUX=enforcing before).
then just reboot the system by giving
reboot
Now the mail goes without any hassle.
Configuration
From Email Address : [noreply@yourdomain.com]
From Name : [your domain name]
SMTP Host : smtp.gmail.com
Type of Encryption : SSL
SMTP Port : 465
SMTP Authentication : YES
Username : [your mail id]
Password : [your password]
answered Feb 10, 2016 at 7:17
SMTP Error: could not authenticate
I had the same problem. The following troubleshooting steps helped me.
- I turned off two-factor authentication in my gmail account.
- I allowed less secure apps to access my gmail account. To get it working, I had to go to
myaccount.google.com->Sign-in & security->Apps with account access, and turnAllow less secure appstoON(near the bottom of the page). - At this step, when I tried to register a user, I would get the same error. Google would sent me a warning message that someone has my password and the login was blocked.
- Gmail will then provide you with options. You either click whether the activity was yours or not yours. Click the option that the activity was yours.
- Try registration again. It should now work.
![]()
cSteusloff
2,4376 gold badges27 silver badges50 bronze badges
answered Dec 14, 2017 at 11:47
There is no issue with your code.
Follow below two simple steps to send emails from phpmailer.
You have to disable 2-step verification setting for google account if you have enabled.
Turn ON allow access to less secure app.
answered Apr 12, 2018 at 7:24
![]()
0 Пользователей и 1 Гость просматривают эту тему.
- 6 Ответов
- 14024 Просмотров

Добрый день всем
у меня случилась грабля — отправляется почта но не на все ящики, точнее почти на все не отправляется, кроме некоторых моих.
раньше отправка была через php mail — на мои ящики приходило — а заказчик пишет что не может зарегиться — не приходит письмо
перепробовал все, Joomla 3.3
даже решил через smtp для яндекса — теперь выскакивает ошибка подключения
сейчас настройки для сервера следующие
отправка почты — Да
способ — smtp
email: имя@yandex.ru
отправитель: ИМЯ
авторизация: Да
защита: TLS
порт: 465
имя пользователя: имя
пароль: ***
server: smtp.yandex.ru
где то вскользь видел, что проблемы могут на стороне хостера — но не понимаю в чем они могут быть
не работает ни один способ отправки
хостер 1gb
нашел статейку, попробовал
Решение проблем связанных с отправкой почты в Joomla и VirtueMart
Самый простой способ отправки почты через функцию php mail, используйте этот способ отправки на вашем хостинге. Если вы в настройках указали способ отправки через php mail, а почта не отправляется, убедитесь, работает ли функция mail(). Для этого создайте в корне сайта файл test.php следующего содержания.
<?php
if (mail(«vasha_pachta@mail.ru», «Тема», «бла бла…nбла…бла….»))
echo ‘OK’;
else
echo ‘ERROR’;
?>
Запускаем файл: адрес_вашего_сайта/test.php, если после запуска скрипт выводит «ERROR», значит функция mail не работает на вашем сервере, стучите в техподдержку хостера, пускай подключают, все же 21 век на дворе). Если скрипт вывел «OK», значит письмо принято к отправке.
почта отправляется и приходит
значит mail() работает — там далее описано как править файл
После этого если письмо не дошло нужно подправить файл Joomla отвечающий за отправку почты. Открываем файл librariesphpmailerphpmailer.php находим примерно в 472 строке след. участок кода
1
$params = sprintf(«-oi -f %s», $this->Sender);
заменяем найденую строку на
1
2
$params = sprintf(«-oi -f %s», $this->Sender);
$params = «»;
В большинстве случаев проблема решается таким способом. Дело в том, что переменная $params используется в качестве 5го аргумента функции mail(), хотя обычно в функцию mail() достаточно передать 4 параметра. На некоторых хостингах почта из Joomla не отправляется с этим 5ым параметром.
если и после этого письма не отправляются значит они попадают в спам на стороне хостинга (возможно дело в адресе отправителя) либо на принимающей стороне (посмотрите в папке спам).
проблема в том что это описание для старой Joomla — в новой все подругому
причем самое паскудное, что регистрация через mail() приходит только на мои пару ящиков
вот это ваще мистика

то есть она ходит на мой gmail на мой mail
а на все остальные не ходит — эт ваще пипец какой то
мож конечно она работает через локальный комп на котором денвер стоит…
Дабы не создавать новые темы.спрошу здесь.Joomla стоит на локальном сервере.Настроил почту через Gmail. В настройках Gmail Установите переключатель Включить IMAP. Сделал.
В Joomla всё прописал по инструкции.При попытке отправить тестовое сообщение выводится ошибка. SMTP Error: Could not authenticate.
Помогите разобраться пожалуйста.
Чет долго никто не закроет вопрос.
Один из ответов на эту тему SMTP Error: Could not authenticate нашел на сайте здесь
« Последнее редактирование: 12.11.2022, 20:47:06 от avtomastersu »
Записан
бред полнейший
если напрямую не указывать и не включать пароль приложений, то достаточно настроить порты
а smtp надо в почте ращрешить
Записан
индивидуальная помощь: @SetAlexx
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 = 2set - 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 = "example@gmail.com"; $mail->Password = "*******"; $mail->setFrom("example@gmail.com", "Alex"); $mail->Subject = "Тест, отправка письма"; $mail->msgHTML("Message"); $mail->addAddress("example@mail.ru"); 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 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbtI534-5.7.14 qNIYrbZEk6FWx5rHcj6iG24Wnch4-cJAfM8uoUKM9jkHSMq_RaHs_A6dTS2Os70c6MUtaD534-5.7.14 5g_o5siaKUXvyrEugwt0FU-QBcUwp5HHAFfiHmTpuRu57eG1k4pH6sv5fXSQn2dgrZDEtn534-5.7.14 29ptACC7djB5Hv_usdmgN5yckn6u5Q79E3JqMGpS8nN7ZagN2geB2kO3-jkRJN8grPtIVK534-5.7.14 rAXLtSmpqVqRunISlK0V0x80FTYLY> Please log in via your web browser and534-5.7.14 then try again.534-5.7.14 Learn more at534 5.7.14 https://support.google.com/mail/answer/78754 q24sm1694776lff.48 - gsmtp
2017-10-23 19:44:18 SMTP ERROR: Password command failed: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbtI534-5.7.14 qNIYrbZEk6FWx5rHcj6iG24Wnch4-cJAfM8uoUKM9jkHSMq_RaHs_A6dTS2Os70c6MUtaD534-5.7.14 5g_o5siaKUXvyrEugwt0FU-QBcUwp5HHAFfiHmTpuRu57eG1k4pH6sv5fXSQn2dgrZDEtn534-5.7.14 29ptACC7djB5Hv_usdmgN5yckn6u5Q79E3JqMGpS8nN7ZagN2geB2kO3-jkRJN8grPtIVK534-5.7.14 rAXLtSmpqVqRunISlK0V0x80FTYLY> Please log in via your web browser and534-5.7.14 then try again.534-5.7.14 Learn more at534 5.7.14 https://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.
Welcome to the forum!
First of all, you should update Joomla to the latest version, which is 3.9.16 at the moment, but possibly 3.9.17 in the next few hours. Make sure that you have a full backup of the site, should something go wrong. It would also be a good idea to run a test update of a clone of the production site, restored on a localhost workstation, running a bundle like Wampserver.
The different behaviour of the browsers sounds strange. Check the browser extensions if some add-on interferes in the process. Just a guess.
The SMTP server or some firewall software may have something to do with the issue. However, it is possible to fully debug the connection and authentication process between Joomla and the SMTP server.
The instructions below show how to get a listing of all the SMTP requests and responses between the Joomla site and the SMTP server. The low level transaction log shows in detail what goes on during the opening of the SMTP connection and the authentication. You can then get your IT department or hosting provider to resolve any issues, if required.
Go to Extensions — Plugins and configure the system plugin ‘System — Debug’ with the following settings, which limit the debug output to Super User sessions only:
- Allowed Groups: Super Users
- Log Priorities: All
- Log Categories: mail
- Log Almost Everything
Go to Global Configuration and select the Debug option in System tab — Debug Settings — Debug System.
Then go to the Server tab — Mail Settings and click the button Send Test Mail.
The test result, success or failure, will then get displayed as a system message. Download the detailed log file ‘everything.php’ from the Joomla log folder, usually administrator/logs. If your site was installed some time ago, check the /logs sub folder in the main Joomla folder. Post the relevant lines from the listing here if you have any questions.