Smtp error could not authenticate перевод

Здравствуйте, у меня при отправке по SMTP выводится ошибка: SMTP Error: Could not authenticate. Как это исправить?

За последние 24 часа нас посетили 11532 программиста и 1149 роботов. Сейчас ищут 165 программистов …


  1. VaneS

    VaneS
    Активный пользователь

    С нами с:
    16 ноя 2011
    Сообщения:
    631
    Симпатии:
    3
    Адрес:
    Россия

    Здравствуйте, у меня при отправке по SMTP выводится ошибка:

    1. SMTP Error: Could not authenticate.

    Как это исправить?


  2. Ganzal

    Команда форума
    Модератор

    С нами с:
    15 мар 2007
    Сообщения:
    9.901
    Симпатии:
    968

    правильно авторизоваться на smtp-сервере. русским по белому написано что? ошибка смтп: не смог аутентифицироваться


  3. VaneS

    VaneS
    Активный пользователь

    С нами с:
    16 ноя 2011
    Сообщения:
    631
    Симпатии:
    3
    Адрес:
    Россия

    Почему с локального сервера все работает, а с удаленной VPS выдает эту ошибку? Ранее все работало, а на этой неделе просто перестал отправлять письма


  4. Ganzal

    Команда форума
    Модератор

    С нами с:
    15 мар 2007
    Сообщения:
    9.901
    Симпатии:
    968

    мб настройки смтп сменили?


  5. VaneS

    VaneS
    Активный пользователь

    С нами с:
    16 ноя 2011
    Сообщения:
    631
    Симпатии:
    3
    Адрес:
    Россия

    Да в том и дело что ничего не меняли. Пытался подключаться к майлу и яндексу, ошибка оставалась прежняя, хотя ранее все работало нормально.

  6. Предположение: у хостера обновили ssl, php-ssl — нет.


  7. VaneS

    VaneS
    Активный пользователь

    С нами с:
    16 ноя 2011
    Сообщения:
    631
    Симпатии:
    3
    Адрес:
    Россия

  8. Попробуй поиграть с безопасностью транспорта:
    $mail->SMTPSecure = ‘tls’;
    или
    $mail->SMTPSecure = ‘ssl’;

    Добавлено спустя 2 минуты 28 секунд:

    я понимаю, но вы обновляли openSSL после небезызвестного бага?


  9. Ganzal

    Команда форума
    Модератор

    С нами с:
    15 мар 2007
    Сообщения:
    9.901
    Симпатии:
    968


  10. VaneS

    VaneS
    Активный пользователь

    С нами с:
    16 ноя 2011
    Сообщения:
    631
    Симпатии:
    3
    Адрес:
    Россия

    Кажется нет, а как это сделать?

    Добавлено спустя 9 минут 53 секунды:

    Моя CMS использует phpmailer, нашел там строку и заменил настройку, все заработало, спасибо большое!!!
    Так все же, как обновить на сервере SSL?


  11. Ganzal

    Команда форума
    Модератор

    С нами с:
    15 мар 2007
    Сообщения:
    9.901
    Симпатии:
    968

    руками из исходников скомпилировать. ну это если хорошо знаете что это. иначе дождитесь когда ментейнеры обновят rpm в репах центоса.

  12. Там, чуть ли не в одних из первых появляется.
    yum check-update
    прочитает базу и выплюнет длинный список того, что давненько не обновлялось.
    далее 2 пути:
    1) обновить 1 openssl: yum update openssl
    2) обновить все: yum update

0 Пользователей и 1 Гость просматривают эту тему.

  • 6 Ответов
  • 14112 Просмотров

Добрый день всем

у меня случилась грабля — отправляется почта но не на все ящики, точнее почти на все не отправляется, кроме некоторых моих.
раньше отправка была через 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() приходит только на мои пару ящиков
вот это ваще мистика :o :o :o
 то есть она ходит на мой 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

За последние 24 часа нас посетили 9760 программистов и 785 роботов. Сейчас ищут 438 программистов …

  1. VaneS
    Активный пользователь

    С нами с:
    16 ноя 2011
    Сообщения:
    631
    Симпатии:
    3
    Адрес:
    Россия

    Здравствуйте, у меня при отправке по SMTP выводится ошибка:

    1. SMTP Error: Could not authenticate.

    Как это исправить?

  2. Команда форума
    Модератор

    С нами с:
    15 мар 2007
    Сообщения:
    9.901
    Симпатии:
    968

    правильно авторизоваться на smtp-сервере. русским по белому написано что? ошибка смтп: не смог аутентифицироваться

  3. VaneS
    Активный пользователь

    С нами с:
    16 ноя 2011
    Сообщения:
    631
    Симпатии:
    3
    Адрес:
    Россия

    Почему с локального сервера все работает, а с удаленной VPS выдает эту ошибку? Ранее все работало, а на этой неделе просто перестал отправлять письма

  4. Команда форума
    Модератор

    С нами с:
    15 мар 2007
    Сообщения:
    9.901
    Симпатии:
    968

    мб настройки смтп сменили?

  5. VaneS
    Активный пользователь

    С нами с:
    16 ноя 2011
    Сообщения:
    631
    Симпатии:
    3
    Адрес:
    Россия

    Да в том и дело что ничего не меняли. Пытался подключаться к майлу и яндексу, ошибка оставалась прежняя, хотя ранее все работало нормально.

  6. Предположение: у хостера обновили ssl, php-ssl — нет.

  7. VaneS
    Активный пользователь

    С нами с:
    16 ноя 2011
    Сообщения:
    631
    Симпатии:
    3
    Адрес:
    Россия
  8. Попробуй поиграть с безопасностью транспорта:
    $mail->SMTPSecure = ‘tls’;
    или
    $mail->SMTPSecure = ‘ssl’;

    Добавлено спустя 2 минуты 28 секунд:

    я понимаю, но вы обновляли openSSL после небезызвестного бага?

  9. Команда форума
    Модератор

    С нами с:
    15 мар 2007
    Сообщения:
    9.901
    Симпатии:
    968
  10. VaneS
    Активный пользователь

    С нами с:
    16 ноя 2011
    Сообщения:
    631
    Симпатии:
    3
    Адрес:
    Россия

    Кажется нет, а как это сделать?

    Добавлено спустя 9 минут 53 секунды:

    Моя CMS использует phpmailer, нашел там строку и заменил настройку, все заработало, спасибо большое!!!
    Так все же, как обновить на сервере SSL?

  11. Команда форума
    Модератор

    С нами с:
    15 мар 2007
    Сообщения:
    9.901
    Симпатии:
    968

    руками из исходников скомпилировать. ну это если хорошо знаете что это. иначе дождитесь когда ментейнеры обновят rpm в репах центоса.

  12. Там, чуть ли не в одних из первых появляется.
    yum check-update
    прочитает базу и выплюнет длинный список того, что давненько не обновлялось.
    далее 2 пути:
    1) обновить 1 openssl: yum update openssl
    2) обновить все: yum update

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's user avatar

Cœur

36.3k25 gold badges191 silver badges258 bronze badges

asked Oct 16, 2010 at 16:57

Alejandro Echeverri's user avatar

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

enter image description here

Joundill's user avatar

Joundill

6,41211 gold badges35 silver badges50 bronze badges

answered Sep 4, 2015 at 14:56

cwd's user avatar

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

malletjo's user avatar

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

Bubba's user avatar

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.

  1. Create a new password for the Gmail account you want to use
  2. Enable less secure apps in Google Security settings
  3. Use the Display Unlock Captcha page to give your app or website permission to sign in to Gmail. Click Continue or follow the instructions.
  4. 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's user avatar

Greg

20.8k17 gold badges81 silver badges106 bronze badges

answered Jul 20, 2017 at 8:24

pyfork's user avatar

pyforkpyfork

3,5972 gold badges20 silver badges18 bronze badges

1

my solution is:

  1. change gmail password
  2. on gmail «Manage your google Account» > Security > Turn on 3rd party app Access
  3. 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

ibrahim saputra's user avatar

1

Because Allow less secure apps is no longer available

enter image description here

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

app

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.

app password

answered Jun 28, 2022 at 2:10

Kym NT's user avatar

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

svandragt's user avatar

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

Rikin Adhyapak's user avatar

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

JackSparrow's user avatar

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. 

enter image description here

You will reach a page like this,

enter image description here

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

Arefe's user avatar

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

Ehsan's user avatar

EhsanEhsan

1,02211 silver badges20 bronze badges

  1. first go to https://myaccount.google.com
  2. Select Security tab
  3. Scroll down and select ‘Less secure app access’
  4. Turn on access

This will solve my “SMTP Error: Could not authenticate” in PHPMailer error.

answered Apr 29, 2020 at 13:07

ruwanmadhusanka's user avatar

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

user3809638's user avatar

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

Gosforth's user avatar

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

anu's user avatar

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

Jathin Prasad's user avatar

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 turn Allow less secure apps to ON (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's user avatar

cSteusloff

2,4376 gold badges27 silver badges50 bronze badges

answered Dec 14, 2017 at 11:47

Joshua Mutinda's user avatar

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

Ravindra Miyani's user avatar

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's user avatar

Cœur

36.3k25 gold badges191 silver badges258 bronze badges

asked Oct 16, 2010 at 16:57

Alejandro Echeverri's user avatar

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

enter image description here

Joundill's user avatar

Joundill

6,41211 gold badges35 silver badges50 bronze badges

answered Sep 4, 2015 at 14:56

cwd's user avatar

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

malletjo's user avatar

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

Bubba's user avatar

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.

  1. Create a new password for the Gmail account you want to use
  2. Enable less secure apps in Google Security settings
  3. Use the Display Unlock Captcha page to give your app or website permission to sign in to Gmail. Click Continue or follow the instructions.
  4. 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's user avatar

Greg

20.8k17 gold badges81 silver badges106 bronze badges

answered Jul 20, 2017 at 8:24

pyfork's user avatar

pyforkpyfork

3,5972 gold badges20 silver badges18 bronze badges

1

my solution is:

  1. change gmail password
  2. on gmail «Manage your google Account» > Security > Turn on 3rd party app Access
  3. 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

ibrahim saputra's user avatar

1

Because Allow less secure apps is no longer available

enter image description here

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

app

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.

app password

answered Jun 28, 2022 at 2:10

Kym NT's user avatar

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

svandragt's user avatar

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

Rikin Adhyapak's user avatar

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

JackSparrow's user avatar

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. 

enter image description here

You will reach a page like this,

enter image description here

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

Arefe's user avatar

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

Ehsan's user avatar

EhsanEhsan

1,02211 silver badges20 bronze badges

  1. first go to https://myaccount.google.com
  2. Select Security tab
  3. Scroll down and select ‘Less secure app access’
  4. Turn on access

This will solve my “SMTP Error: Could not authenticate” in PHPMailer error.

answered Apr 29, 2020 at 13:07

ruwanmadhusanka's user avatar

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

user3809638's user avatar

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

Gosforth's user avatar

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

anu's user avatar

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

Jathin Prasad's user avatar

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 turn Allow less secure apps to ON (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's user avatar

cSteusloff

2,4376 gold badges27 silver badges50 bronze badges

answered Dec 14, 2017 at 11:47

Joshua Mutinda's user avatar

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

Ravindra Miyani's user avatar

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's user avatar

Cœur

36.3k25 gold badges191 silver badges258 bronze badges

asked Oct 16, 2010 at 16:57

Alejandro Echeverri's user avatar

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

enter image description here

Joundill's user avatar

Joundill

6,41211 gold badges35 silver badges50 bronze badges

answered Sep 4, 2015 at 14:56

cwd's user avatar

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

malletjo's user avatar

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

Bubba's user avatar

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.

  1. Create a new password for the Gmail account you want to use
  2. Enable less secure apps in Google Security settings
  3. Use the Display Unlock Captcha page to give your app or website permission to sign in to Gmail. Click Continue or follow the instructions.
  4. 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's user avatar

Greg

20.8k17 gold badges81 silver badges106 bronze badges

answered Jul 20, 2017 at 8:24

pyfork's user avatar

pyforkpyfork

3,5972 gold badges20 silver badges18 bronze badges

1

my solution is:

  1. change gmail password
  2. on gmail «Manage your google Account» > Security > Turn on 3rd party app Access
  3. 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

ibrahim saputra's user avatar

1

Because Allow less secure apps is no longer available

enter image description here

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

app

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.

app password

answered Jun 28, 2022 at 2:10

Kym NT's user avatar

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

svandragt's user avatar

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

Rikin Adhyapak's user avatar

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

JackSparrow's user avatar

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. 

enter image description here

You will reach a page like this,

enter image description here

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

Arefe's user avatar

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

Ehsan's user avatar

EhsanEhsan

1,02211 silver badges20 bronze badges

  1. first go to https://myaccount.google.com
  2. Select Security tab
  3. Scroll down and select ‘Less secure app access’
  4. Turn on access

This will solve my “SMTP Error: Could not authenticate” in PHPMailer error.

answered Apr 29, 2020 at 13:07

ruwanmadhusanka's user avatar

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

user3809638's user avatar

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

Gosforth's user avatar

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

anu's user avatar

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

Jathin Prasad's user avatar

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 turn Allow less secure apps to ON (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's user avatar

cSteusloff

2,4376 gold badges27 silver badges50 bronze badges

answered Dec 14, 2017 at 11:47

Joshua Mutinda's user avatar

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

Ravindra Miyani's user avatar

0 Пользователей и 1 Гость просматривают эту тему.

  • 6 Ответов
  • 14021 Просмотров

Добрый день всем

у меня случилась грабля — отправляется почта но не на все ящики, точнее почти на все не отправляется, кроме некоторых моих.
раньше отправка была через 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() приходит только на мои пару ящиков
вот это ваще мистика :o :o :o
 то есть она ходит на мой 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

PHPMailer is a great tool to send emails safely and easily using SMTP authentication.

But, sometimes this may fail due to incompatible server settings or incorrect SMTP configuration.

smtp error: could not authenticate” is one such problem reported by website owners when using PHPmailer to send emails.

At Bobcares, we resolve such email errors as part of our Outsourced Technical Support for web hosting providers.

Today, let’s see the top 5 reasons for this error and how our engineers fix it.

Simply put, this error says:  “You try to connect to SMTP server, but it can’t authenticate you“.

So, it could mean,

  • The PHP application was able to connect to SMTP server, but the authentication failed.
  • Application was not able to connect to the SMTP server.

What’s wrong here? Let’s have a quick look.

Causes and Fixes for “smtp error: could not authenticate” error in phpmailer

1) Wrong SMTP authentication details

Each mail server uses an authentication system to validate users before they can connect and send emails.

When you send an email from your script, the mail server attempts to identify the user with the account’s username and password.

If this authentication fails, the mail server rejects the connection and users receive the error “smtp error: could not authenticate“.

Solution

We’ll ensure that correct username and password are given in the mail script.

In case of default email accounts, the full username(user@domain.com) should be given in the application.

Also, if the password was recently modified, it should be updated in the email application.

2) Wrong SMTP port and SMTP Host

Users should enter the mail server details in the “$mail->Host” field of the email application.

For example, if you use Gmail as your mail server, the hostname should be “smtp.gmail.com“.

Sometimes, a typo in the hostname or an inactive mail server result in this error.

Similarly, for port numbers, the default SMTP port is 25, but some mail servers use custom ports, such as 587, to avoid spam.

Also, some mail servers will be configured to allow emails only via SSL port 465.

It is also possible that some email providers restrict access to their SMTP port using firewall rules.

Incorrect port entry in SMTP settings or firewall restrictions may cause email delivery errors.

Solution

We’ll ensure the DNS connectivity of the mail server with the command.

dig mail.domain.com

Also, to identify the correct SMTP port and confirm connectivity to the SMTP port, we use the command:

telnet domain.com 25

We cross-check the SMTP settings in the application and make sure that correct SMTP host and port is used.

If we find any firewall restrictions, the IP should be whitelisted in the firewall.

3) SMTP encryption settings

For secure email transmission, most users prefer SMTP with encryption. SSL and TLS are the 2 encryption protocols used.

But, on some mail servers, SSL/TLS support may not be enabled or the existing SSL certificate may have expired.

What if users specify encryption in their application? Result is “smtp error: could not authenticate” error.

Solution

Our Support Engineers ensure that Apache and PHP are properly configured on the server with ‘mod_ssl‘ and ‘openssl‘ so that SSL can work on the server.

We’ll also verify the validity of mail server’s SSL certificate using the command:

openssl s_client -connect mail.example.com:25 -starttls smtp

So, the solution here is to properly configure SSL for the server or remove the encryption used in the SMTP settings.

4) Google blocks insecure access

Gmail enforces strict security restrictions.

If an app doesn’t meet these security standards, it may block access because these apps are easier to break into.

Users who authenticate to Gmail server receive the error “smtp error: could not authenticate” because Google considers username and password login as insecure.

Solution

Ideally, we reconfigure the app so that it meets the Google standards. If this is not possible, we’ll help website owners to loosen the security restrictions using the below steps.

  • Sign in to the Google admin console.
  • Go to Security > Basic settings.
  • Go to Less Secure Apps.
  • Turn on Allow less secure apps.

phpmailer smtp error: could not authenticate

Allow less secure apps in gmail account

5) Expired Password

This can happen once in a while.

Some servers are set to auto expire passwords and app maintainers forget to update them in time.

When the application tries to connect, the mail server could not validate the password.

Result is “smtp error: could not authenticate” error.

Solution

This usually happens when the account owner missed the notification email about password expiry.

In such cases, we reset the password and also update it in the email application.

We also make sure that the notification email is set correctly, and in some cases, we remove the password expiration set for the mailbox.

Conclusion

smtp error: could not authenticate” is a common error when users send emails via PHPMailer using SMTP authentication. This error occurs when the application can’t establish an SMTP connection to the mail server. Today, we’ve seen the top 5 causes of this error and how our Support Engineers fix them.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

SEE SERVER ADMIN PLANS

var google_conversion_label = «owonCMyG5nEQ0aD71QM»;

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 = "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.

PHPMailer — научитесь отправлять электронную почту из Gmail за 10 минут без ошибок

Я использую PHPMailer в простом скрипте для отправки электронной почты через Gmail, и я получаю «Неизвестную ошибку» (по крайней мере, для меня!):

Ошибка SMTP: не удалось пройти аутентификацию. Ошибка: ошибка SMTP: не удалось пройти аутентификацию.

Ошибка SMTP-сервера: 5.7.1 Имя пользователя и пароль не приняты. Подробнее см. 535 5.7.1 http://mail.google.com/support/bin/answer.py?answer=14257 p38sm2467302ybk.16.

Я читал о настройке OpenSSL для соединений SSL / TLS и сделал это. Apache и PHP настроены правильно (с расширением OpenSSL, работающим в PHP, и mod_ssl, работающим в Apache 2.2.16).

Это сценарий PHP:

 <?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 = '[email protected]'; $Correo->Password = 'gmailpassword'; $Correo->SetFrom('[email protected]','De Yo'); $Correo->FromName = 'From'; $Correo->AddAddress('[email protected]'); $Correo->Subject = 'Prueba con PHPMailer'; $Correo->Body = '

Bienvenido! Esto Funciona!

'; $Correo->IsHTML (true); if (!$Correo->Send()) { echo 'Error: $Correo->ErrorInfo'; } else { echo 'Message Sent!'; } ?> var13 ->

Имя пользователя и пароль в порядке, и я без проблем попробовал в Thunderbird. Я также использовал SSL-аутентификацию и порт 465, получив ту же ошибку.

  • 1 Это странно, поскольку ошибка довольно четко указывает на ошибку имени пользователя / пароля, а не на проблему протокола. У вас нет в пароле специальных символов, которые могут быть неправильно переданы?
  • 1. откройте imap и 2. myaccount.google.com/lesssecureapps

Попробуйте вместо этого:

$ Correo->Имя пользователя = "[email protected]";

Я протестировал его, и он отлично работает без каких-либо других изменений

  • Я этого не понимаю! что изменилось?
  • Порядок писем Cammel $ Correo-> UserName

Я столкнулся с этой проблемой. Чтобы он заработал, мне пришлось перейти на myaccount.google.com -> «Вход и безопасность» -> «Приложения с доступом к аккаунту» и включить «Разрешить менее безопасные приложения» (в нижней части страница).

В качестве альтернативы вы можете перейти по этой прямой ссылке на эти настройки

  • 3 Прошу прощения за поздний ответ. Для тех из вас, кто не может видеть диалоговое окно Разрешить менее безопасные приложения. 1. Перейдите в свою учетную запись 2. Подключенные приложения и сайты (вкладка «Вход и безопасность») 3. Вы должны увидеть три вкладки в разделе «Подключенные приложения и сайты». Но если вы видите только - «Приложения, подключенные к вашей учетной записи» и «Сохраненные пароли». 4. На боковой панели нажмите «Вход в Google» - отключите двухэтапную аутентификацию. 5. Теперь вы увидите Разрешить менее безопасные приложения. Включите, если Вкл.
  • Я не видел раздела Разрешить менее безопасные приложения, кроме пароля приложения. Подробнее support.google.com/accounts/answer/185833?hl=en
  • @TheHive у меня тоже самое происходит, пришлось отключить двухэтапную проверку. Спасибо большое.
  • У меня вопрос: можно ли обойтись без отключения двухэтапной аутентификации? Я хотел бы иметь это для Gmail если возможно.
  • Ок, написал ответ, как это сделать при включенной двухэтапной проверке.

это проблема с GMail

прочтите эту справку Google (https://support.google.com/mail/answer/14257?p=client_login&rd=1)

  1. Откройте свой веб-браузер и войдите в Gmail со страницы http://mail.google.com/mail. Если вы видите запрос проверки слова, введите буквы на искаженном изображении и завершите вход.
  2. Закройте браузер и попробуйте снова получить доступ к своим сообщениям в почтовом клиенте.
  3. Если у вас по-прежнему возникают проблемы, посетите http://www.google.com/accounts/DisplayUnlockCaptcha и войдите в систему, используя свое имя пользователя и пароль Gmail. При необходимости введите буквы на искаженной картинке.
  4. Щелкните Продолжить.
  5. Перезапустите почтовый клиент и попробуйте снова получить доступ к сообщениям в почтовом клиенте.

  • может потребовать от вас подождать несколько минут, у меня не сработало сразу ... нажмите "Продолжить" дважды.

Я получил ту же ошибку, и в моем случае это был пароль. В моем пароле есть специальные символы, и если вы введете пароль, не экранируя специальные символы, ошибка будет продолжать отображаться. Например $mail->Password = ' por$ch3'; действителен, но не будет работать с приведенным выше кодом. Решение должно быть таким: $mail->Password = 'por$ch3'; Обратите внимание на обратную косую черту, которую я поставил перед символом доллара в моем пароле. Это должно сработать, если у вас есть пароль с использованием специальных символов

  • 1 Вы можете просто использовать одинарные кавычки. Только одиночная кавычка должна быть экранирована.

Я получил эту ошибку из-за знаков процента в пароле.

  • Работаю на меня. Благодарность

У меня возникла такая же ошибка при настройке WP-Mail-SMTP плагин в WordPress.

Проблема не исчезнет, ​​даже если я «трижды проверил» настройки и учетные данные для входа и смогу войти в систему вручную с помощью браузера.

Вот список шагов, которые вы можете предпринять, чтобы это исправить.

  1. Создайте новый пароль для учетной записи Gmail, которую хотите использовать.
  2. Включите менее безопасные приложения в настройках Google Security
  3. Использовать Display Unlock Captcha страницу, чтобы разрешить вашему приложению или веб-сайту вход в Gmail. Нажмите Continue или следуйте инструкциям.
  4. Войдите в систему, используя приложение или веб-сайт. У меня работают настройки smtp: 1) Хост SMTP: smtp.gmail.com 2) Порт SMTP: 587 3) Шифрование: TLS 4) Аутентификация: аутентификация SMTP 5) Имя пользователя: [email protected] 6) Пароль: examplesecret
  • Вам не нужно включать пересылку, POP или IMAP в Gmail, чтобы это работало.

Для меня у меня были специальные символы в поле моего пароля, и я поместил его как $ mail-> Password = "por $ ch3", которые работают для SMTP-сервера Gmail, но не для других; поэтому я просто заменил двойные кавычки на одинарные, и у меня это работает. $ mail-> Пароль = 'por $ ch3';

  • Я надеюсь, что вы все еще не используете этот пароль, потому что: 1. Вы только что предоставили его в Интернет. 2. Это совсем не безопасно. dl.dropboxusercontent.com/u/209/zxcvbn/test/index.html
  • 1 для пояснения, это был просто пример
  • Это не решение.

Если вы по-прежнему сталкиваетесь с ошибкой при отправке электронной почты, с тем же сообщением об ошибке. Попробуй это:

$mail->SMTPSecure = 'tls'; $mail->Host = 'smtp.gmail.com'; 

прямо перед строкой:

$send = $mail->Send(); 

или в другом смысле перед вызовом функции Send ().

Проверено и работает.

  • 2 Это тоже не выход.

У меня была такая же проблема, и я безуспешно выполнял все советы, включая настройку Gmail (например, менее безопасный доступ к приложениям). Но, наконец, когда я сменил пароль на другой, по какой-то причине это сработало! К вашему сведению, в исходном пароле не было специальных символов.

  1. сначала перейдите на https://myaccount.google.com
  2. Выберите вкладку Безопасность
  3. Прокрутите вниз и выберите "Небезопасный доступ к приложениям".
  4. Включите доступ

Это решит мою ошибку «Ошибка SMTP: не удалось пройти аутентификацию» в ошибке PHPMailer.

Другой пост предназначен для решения проблемы, но не описывает, как это сделать, если включена двухэтапная проверка. В этом случае опция разрешить менее безопасные приложения недоступна. Вот ответ, как это сделать:

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. 

Это должно решить проблему.

  • Это сработало для меня. Спасибо! <3

мое решение:

  1. изменить пароль Gmail
  2. в gmail "Управление учетной записью Google"> Безопасность> Включите доступ к сторонним приложениям
  3. Это новый шаг, который я обнаружил с помощью UnlockingCaptcha, который сообщил на этом сайте, точный сайт - https://accounts.google.com/b/0/DisplayUnlockCaptcha, но, возможно, вы сначала захотите прочитать предыдущий сайт.

Это все, надеюсь, это сработает для вас

У меня была такая же проблема с аутентификацией. Исправление заключалось в настройке двухэтапной проверки и создании специального пароля приложения для устройства (сообщения об ошибках для блокировки устройства будут отображаться в настройках вашей учетной записи -> «Уведомления и предупреждения», если у вас такая же проблема с моей)

Это была проблема с selinux. Я только что обновил приведенную ниже часть в файле / etc / selinux / config SELINUX=permissive (раньше это было SELINUX = принудительное исполнение). затем просто перезагрузите систему, дав перезагрузку. Теперь почта идет без проблем. Конфигурация

From Email Address : [[email protected]] 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] 

Ошибка SMTP: не удалось пройти аутентификацию У меня такая же проблема. Мне помогли следующие шаги по устранению неполадок.

  • Я отключил двухфакторную аутентификацию в своей учетной записи Gmail.
  • Я разрешил менее безопасным приложениям доступ к моей учетной записи Gmail. Чтобы он заработал, мне пришлось пойти в myaccount.google.com -> Sign-in & security -> Apps with account access, и повернуть Allow less secure apps к ON (внизу страницы).
  • На этом этапе, когда я пытался зарегистрировать пользователя, я получал ту же ошибку. Google отправлял мне предупреждающее сообщение о том, что у кого-то есть мой пароль, а вход заблокирован.
  • Gmail предложит вам варианты. Вы либо нажимаете, было ли это действие вашим или не вашим. Выберите вариант, что действие было вашим.
  • Попробуйте зарегистрироваться еще раз. Теперь он должен работать.

С вашим кодом проблем нет.

Выполните два простых шага, чтобы отправить электронную почту из phpmailer.

  • Вы должны отключить настройку двухэтапной аутентификации для учетной записи Google, если вы ее включили.

  • Поворот НА разрешить доступ к менее безопасному приложению.

У меня была такая же проблема, и я безуспешно делал все подсказки. Наконец, когда я сменил пароль на другой, по какой-то причине это сработало! (в исходном пароле или в новом не было специальных символов)

У меня была такая же проблема, которая была исправлена, следуя приведенным ниже инструкциям.

Протестируйте включение «Доступ для менее безопасных приложений» (что означает, что клиент / приложение не использует OAuth 2.0 - https://oauth.net/2/) для учетной записи, к которой вы пытаетесь получить доступ. Он находится в настройках учетной записи на вкладке «Безопасность», в разделе «Разрешения учетной записи» (недоступно для учетных записей с включенной двухэтапной проверкой): https://support.google.com/accounts/answer/6010255?hl=en

исходная ссылка для ответа: https://support.google.com/mail/thread/5621336?msgid=6292199

Tweet

Share

Link

Plus

Send

Send

Pin

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's user avatar

Cœur

36.4k25 gold badges191 silver badges259 bronze badges

asked Oct 16, 2010 at 16:57

Alejandro Echeverri's user avatar

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

enter image description here

Joundill's user avatar

Joundill

6,42211 gold badges35 silver badges50 bronze badges

answered Sep 4, 2015 at 14:56

cwd's user avatar

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

malletjo's user avatar

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

Bubba's user avatar

BubbaBubba

1011 silver badge7 bronze badges

2

Because Allow less secure apps is no longer available

enter image description here

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

app

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.

app password

answered Jun 28, 2022 at 2:10

Kym NT's user avatar

Kym NTKym NT

6309 silver badges28 bronze badges

1

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.

  1. Create a new password for the Gmail account you want to use
  2. Enable less secure apps in Google Security settings
  3. Use the Display Unlock Captcha page to give your app or website permission to sign in to Gmail. Click Continue or follow the instructions.
  4. 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's user avatar

Greg

20.9k17 gold badges81 silver badges106 bronze badges

answered Jul 20, 2017 at 8:24

pyfork's user avatar

pyforkpyfork

3,5972 gold badges20 silver badges18 bronze badges

1

my solution is:

  1. change gmail password
  2. on gmail «Manage your google Account» > Security > Turn on 3rd party app Access
  3. 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

ibrahim saputra's user avatar

1

I received this error because of percentage signs in the password.

answered Dec 5, 2011 at 13:22

svandragt's user avatar

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

Rikin Adhyapak's user avatar

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

JackSparrow's user avatar

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. 

enter image description here

You will reach a page like this,

enter image description here

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

Arefe's user avatar

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

Ehsan's user avatar

EhsanEhsan

1,02211 silver badges20 bronze badges

  1. first go to https://myaccount.google.com
  2. Select Security tab
  3. Scroll down and select ‘Less secure app access’
  4. Turn on access

This will solve my “SMTP Error: Could not authenticate” in PHPMailer error.

answered Apr 29, 2020 at 13:07

ruwanmadhusanka's user avatar

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

user3809638's user avatar

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

Gosforth's user avatar

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

anu's user avatar

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

Jathin Prasad's user avatar

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 turn Allow less secure apps to ON (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's user avatar

cSteusloff

2,4376 gold badges27 silver badges50 bronze badges

answered Dec 14, 2017 at 11:47

Joshua Mutinda's user avatar

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

Ravindra Miyani's user avatar

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's user avatar

Cœur

36.4k25 gold badges191 silver badges259 bronze badges

asked Oct 16, 2010 at 16:57

Alejandro Echeverri's user avatar

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

enter image description here

Joundill's user avatar

Joundill

6,42211 gold badges35 silver badges50 bronze badges

answered Sep 4, 2015 at 14:56

cwd's user avatar

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

malletjo's user avatar

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

Bubba's user avatar

BubbaBubba

1011 silver badge7 bronze badges

2

Because Allow less secure apps is no longer available

enter image description here

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

app

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.

app password

answered Jun 28, 2022 at 2:10

Kym NT's user avatar

Kym NTKym NT

6309 silver badges28 bronze badges

1

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.

  1. Create a new password for the Gmail account you want to use
  2. Enable less secure apps in Google Security settings
  3. Use the Display Unlock Captcha page to give your app or website permission to sign in to Gmail. Click Continue or follow the instructions.
  4. 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's user avatar

Greg

20.9k17 gold badges81 silver badges106 bronze badges

answered Jul 20, 2017 at 8:24

pyfork's user avatar

pyforkpyfork

3,5972 gold badges20 silver badges18 bronze badges

1

my solution is:

  1. change gmail password
  2. on gmail «Manage your google Account» > Security > Turn on 3rd party app Access
  3. 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

ibrahim saputra's user avatar

1

I received this error because of percentage signs in the password.

answered Dec 5, 2011 at 13:22

svandragt's user avatar

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

Rikin Adhyapak's user avatar

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

JackSparrow's user avatar

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. 

enter image description here

You will reach a page like this,

enter image description here

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

Arefe's user avatar

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

Ehsan's user avatar

EhsanEhsan

1,02211 silver badges20 bronze badges

  1. first go to https://myaccount.google.com
  2. Select Security tab
  3. Scroll down and select ‘Less secure app access’
  4. Turn on access

This will solve my “SMTP Error: Could not authenticate” in PHPMailer error.

answered Apr 29, 2020 at 13:07

ruwanmadhusanka's user avatar

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

user3809638's user avatar

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

Gosforth's user avatar

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

anu's user avatar

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

Jathin Prasad's user avatar

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 turn Allow less secure apps to ON (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's user avatar

cSteusloff

2,4376 gold badges27 silver badges50 bronze badges

answered Dec 14, 2017 at 11:47

Joshua Mutinda's user avatar

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

Ravindra Miyani's user avatar

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Smtp error could not authenticate yandex wordpress
  • Smtp error could not authenticate mail error smtp error could not authenticate
  • Smtp error could not authenticate joomla
  • Smtp error could not authenticate gmail
  • Slow down лансер 10 вариатор ошибка

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии