Answer the question
In order to leave comments, you need to log in
Google smtp sends letters and they come, but the site gives an error, how to fix it?
The letter comes to the mail without problems, but on the site, when sent, it gives an error . With what it can be connected?
Here is the error code(SMTPDebug = 2):
2020-02-05 07:29:21 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP b190sm12047150lfd.39 - gsmtp<br>
2020-02-05 07:29:21 CLIENT -> SERVER: EHLO phpmailer<br>
2020-02-05 07:29:21 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [46.219.222.102]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8<br>
2020-02-05 07:29:21 CLIENT -> SERVER: AUTH LOGIN<br>
2020-02-05 07:29:21 SERVER -> CLIENT: 334 VXNlcm5hbWU6<br>
2020-02-05 07:29:21 CLIENT -> SERVER: a2lyaWxsb3ZpY2h0aXNoa29AZ21haWwuY29t<br>
2020-02-05 07:29:21 SERVER -> CLIENT: 334 UGFzc3dvcmQ6<br>
2020-02-05 07:29:21 CLIENT -> SERVER: MTI0MzUxMjQzNQ==<br>
2020-02-05 07:29:21 SERVER -> CLIENT: 235 2.7.0 Accepted<br>
2020-02-05 07:29:21 CLIENT -> SERVER: MAIL FROM:<[email protected]><br>
2020-02-05 07:29:21 SERVER -> CLIENT: 250 2.1.0 OK b190sm12047150lfd.39 - gsmtp<br>
2020-02-05 07:29:21 CLIENT -> SERVER: RCPT TO:<[email protected]><br>
2020-02-05 07:29:21 SERVER -> CLIENT: 250 2.1.5 OK b190sm12047150lfd.39 - gsmtp<br>
2020-02-05 07:29:21 CLIENT -> SERVER: DATA<br>
2020-02-05 07:29:21 SERVER -> CLIENT: 354 Go ahead b190sm12047150lfd.39 - gsmtp<br>
2020-02-05 07:29:21 CLIENT -> SERVER: Date: Wed, 5 Feb 2020 10:29:20 +0300<br>
2020-02-05 07:29:21 CLIENT -> SERVER: To: [email protected]<br>
2020-02-05 07:29:21 CLIENT -> SERVER: From: Kirill <[email protected]><br>
2020-02-05 07:29:21 CLIENT -> SERVER: Subject: Tema pisma<br>
2020-02-05 07:29:21 CLIENT -> SERVER: Message-ID: <[email protected]><br>
2020-02-05 07:29:21 CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.27 (https://github.com/PHPMailer/PHPMailer)<br>
2020-02-05 07:29:21 CLIENT -> SERVER: MIME-Version: 1.0<br>
2020-02-05 07:29:21 CLIENT -> SERVER: Content-Type: text/html; charset=utf-8<br>
2020-02-05 07:29:21 CLIENT -> SERVER: <br>
2020-02-05 07:29:21 CLIENT -> SERVER: Soderzanie pisma<br>
2020-02-05 07:29:21 CLIENT -> SERVER: <br>
2020-02-05 07:29:21 CLIENT -> SERVER: .<br>
2020-02-05 07:29:22 SERVER -> CLIENT: 250 2.0.0 OK 1580896606 b190sm12047150lfd.39 - gsmtp<br>
2020-02-05 07:29:22 CLIENT -> SERVER: QUIT<br>
2020-02-05 07:29:22 SERVER -> CLIENT: 221 2.0.0 closing connection b190sm12047150lfd.39 - gsmtp<br>
Письмо отправлено
<?php
require 'lib/PHPMailer/PHPMailerAutoload.php'; // Путь к файлу PHPMailerAutoload.php
$mail = new PHPMailer;
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = '[email protected]'; // Почта отправителя (моя 2-я почта для отправки)
$mail->Password = 'pravelniparol'; // Пароль отправителя
$mail->SMTPSecure = 'ssl'; // tls\ssl
$mail->Port = 465; // tls\ssl порт
$mail->CharSet = 'utf-8'; // Кодировка
$mail->SMTPDebug = 2; // Уровень развернутости кода ошибки
$mail->From = '[email protected]'; // Почта отправителя (инфа для отображения в письме)
$mail->FromName = 'Kirill'; // Имя отправителя (инфа для отображения в письме)
$mail->addAddress('[email protected]'); // Кому будет уходить письмо
$mail->isHTML(true); // Формат текста сообщения - text/html
$mail->Subject = 'Tema pisma'; // Тема письма
$mail->Body = 'Soderzanie pisma'; // Содержание письма
$mail->AltBody = ''; // Альтернативное содержане письма (в случаи не поддержки html)
if ($mail->send()) { // Отправка псьма
echo 'Письмо отправлено';
} else {
echo 'Ошибка: ' . $mail->ErrorInfo;
}
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question