K
K
Kirill Gorelov2017-06-01 13:32:32
PHP
Kirill Gorelov, 2017-06-01 13:32:32

PhpMailer doesn't want to work?

Guys, phpmailer doesn't want to work.
Here is my code

require_once __DIR__.'/class.phpmailer.php';

              $Mailer = new PHPMailer();
        $Mailer->SMTPDebug = 2;
        $Mailer->CharSet = 'UTF-8';
        $Mailer->IsSMTP();
        $Mailer->Host = 'smtp.yandex.ru';
        $Mailer->Port = 25;
        $Mailer->SMTPAuth = true;
              $Mailer->Username = "gorelov";
              $Mailer->Password = "pass";

      $Mailer->setFrom('gorelov', 'Mailer');
      $Mailer->addReplyTo('gorelov', 'Information');
      // $Mailer->addAddress('[email protected]');

      $Mailer->Subject = 'Here is the subject';
      $Mailer->Body    = 'This is the HTML message body <b>in bold!</b>';
      $status = $Mailer->Send();

In the logs it says:
You must provide at least one recipient email address - add at least one address for sending.
To do this, I "uncomment" the line // $Mailer->addAddress('[email protected]');
And nothing happens at all.
And I have a question:
1. What is wrong?
2. I uploaded only one class.phpmailer.php file to the server. Do you need any large files?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexander Aksentiev, 2017-06-01
@Kirill-Gorelov

Yandex and other Googles have disabled non-ssl connections for a thousand years. not safe.

R
redya69, 2017-06-01
@redya69

Try $Mailer->SMTPDebug = 3; and $Mailer->SMTPDebug = 4; More detailed debug modes. Maybe there will be an answer

K
Kirill Gorelov, 2017-06-01
@Kirill-Gorelov

Alexander Aksentiev redya69 maddog670 Alexander Penshin Anton
Guys, forwarded the code with your clarifications, but nothing has changed(
And it does not show any additional errors. Changed the encryption type and port.
Zero emotions(

$Mailer = new PHPMailer();
        $Mailer->SMTPDebug = 2;
        $Mailer->SMTPDebug = 3;
        $Mailer->SMTPDebug = 4;
        $Mailer->CharSet = 'UTF-8';
        $Mailer->IsSMTP();
        $Mailer->Host = 'smtp.yandex.ru';
        $Mailer->Port = 465;
        $Mailer->SMTPSecure = 'tls';
        $Mailer->SMTPAuth = true;

L
Loki9928, 2018-12-18
@Loki9928

$Mailer->SMTPSecure = 'tls';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question