I am not receiving emails in Hotmail through PHPMailer

1

I am here with a difficulty ... I am trying to send confirmation emails to my registry but mail does not reach Hotmail.

This is my config

public static function sendMail($subject, $body, $address) {
    $mail = new PHPMailer();
    $mail->isSMTP();
    $mail->SMTPDebug = 2;
    $mail->Debugoutput = 'html';
    $mail->SMTPAuth = true;
    $mail->SMTPSecure = 'tls';
    $mail->Host = 'smtp.live.com';
    $mail->Port = 587;
    $mail->isHTML();
    $mail->Username = '[email protected]';
    $mail->Password = 'myMailPass';
    $mail->SetFrom('[email protected]');
    $mail->Subject = $subject;
    $mail->Body = $body;
    $mail->AddAddress($address);
    $mail->Send();
    
asked by anonymous 14.03.2017 / 00:18

1 answer

0

I use PHPMailer as follows on my site and I usually receive emails:

<?php 

require 'PHPMailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Charset = 'utf8_decode()';
$mail->Host = 'smtp.live.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tsl';
$mail->SMTPAuth = true;
$mail->isHTML(true);
$mail->Username = "[email protected]";
$mail->Password = "minhasenha";

//Define os destinatário(s)
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
$mail->AddAddress('[email protected]');

//Define o remetente
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=    
$mail->AddReplyTo($_POST['email'], utf8_decode($_POST['nome'])); 
$mail->SetFrom($_POST['email'], utf8_decode($_POST['nome']));

$mail->Subject = utf8_decode($_POST['assunto']);
$mail->Body = utf8_decode($_POST['mensagem']);

if (!$mail->send()) {
   echo "Mailer Error: " . $mail->ErrorInfo;
} else {
   echo "<script>javascript:history.back(0)</script>";
}
    
14.03.2017 / 00:22