S
S
sss20192014-08-10 13:45:54
Yandex
sss2019, 2014-08-10 13:45:54

PHPMailer does not work with Yandex smtp. Wrong login or password?

Hello. Can't connect to Yandex smtp server via phpmailer. An error

SMTP -> ERROR: Password not accepted from server: 535 Incorrect authentication data 
SMTP Error: Could not authenticate.

I enter the correct username and password. This is what the send mail script looks like.
require 'mailer/class.phpmailer.php';
  $Mailer = new PHPMailer();
  $Mailer->SMTPDebug = 1;
  $Mailer->CharSet = 'UTF-8';
  $Mailer->IsSMTP();
  $Mailer->Host = 'smtp.yandex.ru';
  $Mailer->Port = 25;
  $Mailer->SMTPAuth = true;
  $Mailer->Username = '[email protected]';
  $Mailer->Password = 'password';

  $Mailer->SetFrom('[email protected]', 'Владимир');
  $Mailer->AddAddress($_GET['email'], $_GET['name']);
  $Mailer->Subject = 'Проверка отправки почты';
  $Mailer->Body = 'Тестовое сообщение.';

  if($Mailer->Send()) echo 'true'; else echo 'false';

Login and password are 100% correct, checked 100 times, connected with the same login and password through other programs.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
Kir, 2014-08-10
@angry_bender

$mail->SMTPSecure = 'tls'
try (pulled from my working code)

S
sss2019, 2014-08-19
@sss2019

The problem was that I was transferring mail for a domain from one Yandex account to another. A day later, the smtp connection itself worked, with the same data and settings.

D
dicem, 2016-05-10
@dicem

Doesn't work because
$Mailer->AltBody = 'Test message.';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question