Если закоментить часть с SMTP авторизацией, то письма приходят, но пишет что они не проверенные. А авторизация почему-то не работает. Может ли быть дело в том, что сайт сейчас лежит на домене без ssl? В общем при попытке авторизации smtp ничего не работает
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
use PHPMailer\PHPMailer\SMTP;
require 'phpmailer/src/Exception.php';
require 'phpmailer/src/PHPMailer.php';
require 'phpmailer/src/SMTP.php';
$mail = new PHPMailer(true);
// $mail->setLanguage('ru', 'phpmailer/language/');
// $mail->isSMTP(); //Send using SMTP
// $mail->Host = 'smtp.gamail.com'; //Set the SMTP server to send through
// $mail->SMTPAuth = true; //Enable SMTP authentication
// $mail->Username = '*****l@gmail.com'; //SMTP username
// $mail->Password = '*****';
// $mail->SMTPSecure = 'ssl'; //SMTP password
// // $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption
// $mail->Port = 465;
$mail->CharSet = 'UTF-8';
//Address
$mail->AddReplyTo('********@gmail.com','First Last');
$mail->setFrom('********l@gmail.com', 'Mailer');
$mail->addAddress('*******@gmail.com', 'Martin Iden');
// Subject
$mail->isHTML(true);
$mail->Subject = 'Привет Тест';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
if(!$mail->send()){
echo 'Mailer Error: ' . $mail->ErrorInfo;
}else{
echo 'Message sent!';
}
// $response = ['message' => $message];
// header('Content-type: application/json');
// echo json_encode($response);
?>