there is my code (it's works for gmail account but not with outlook) I change Host, SMTPDebug(from 0 to 2),Port(from 465 to 587) but it doesn't work
$mailto = $mail;
$mailSub = "Invitation";
$mailMsg = "Bonjour $nom $prenom de cin: $CIN, <br> Votre entretien est
le $date à $heure <br> Merci d'être à l heure <br> Cordialement ";
require '../PHPMailer-master/PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail->IsSmtp();
$mail->SMTPDebug = 2;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Host = "smtp.live.com";
$mail->Port = 587;
$mail->IsHTML(true);
$mail->Username = "*******@******";
$mail->Password = "*********";
$mail->setFrom("*****@******");
$mail->Subject = $mailSub;
$mail->Body = $mailMsg;
$mail->AddAddress($mailto);
$mail->Send();
Outlook.com SMTP server address: smtp-mail.outlook.com
Try this with your host. And for sending to outlook mails. I suggest you go through this website. Website includes ports to SMTP, password, server, SSL, address.
https://www.lifewire.com/what-are-the-outlook-com-smtp-server-settings-1170671
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With