Guys I have the code below, I'm trying everything but nothing change the error "Could not authenticate.
host, user and pass are correct;
<?php
require("PHPMailer-master/src/PHPMailer.php");
require("PHPMailer-master/src/SMTP.php");
require("PHPMailer-master/src/Exception.php");
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
include("conexao.php");
if (!empty($_POST)) {
$user = $_POST["email_usuario"];
$query = mysqli_query($con, "SELECT email_usuario FROM tbusuarios WHERE email_usuario ='$user'");
$rows = mysqli_num_rows($query);
if ($rows > 0) {
$chave = sha1(uniqid(mt_rand(), true));
$conf = mysqli_query($con, "INSERT INTO tbrecsenha (utilizador_recuperacao, confirmacao_recuperacao, data_recuperacao) VALUES ('$user', '$chave', NOW())");
if (mysqli_affected_rows($con) == 1) {
$link = "https://reidaliga.com/recuperar-senha?user=$user&valid=$chave";
$mail = new PHPMailer(true); // Passing true enables exceptions
try {
//Server settings
$mail->isSMTP();
$mail->Host = 'reidaliga.com';
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Port = 465;
$mail->Username = 'meuemail@email.com';
$mail->Password = '@123';
//Recipients
$mail->setFrom('meuemail@email.com', 'Equipe de Suporte - Meu site');
$mail->addAddress($user);
//Content
$mail->isHTML(true);
$mail->Subject = 'Suporte Meu Site | Alteração de Senha!';
$mail->Body = "<b>E-mail automático, por gentileza não responder.</b><br><br>Ola $user,<br>Para alterar sua senha, por favor acesse o link abaixo:<br>$link<br><br><br>Em caso de dúvidas você poderá nos contatar através do email: support.br@reidaliga.com<br>Boa sorte em seus palpites!!<br><b>Equipe Rei da Liga</b><br>";
$mail->send();
echo "<script>window.alert('Um email foi enviado para: $user, caso não encontre na sua caixa de entrada, verifique seu spam');</script>";
echo "<script>window.location.href='logout';</script>";
} catch (Exception $e) {
echo "Erro no envio de e-mail: {$mail->ErrorInfo}";
}
}
}
}
?>
Someone could help me to identify what is wrong? This code is in prod in my server.
I tried to create a new email account, and also I checked the folders that I'm trying to open "PHPMailer". Are all ok in my server.