PHP Sending mail with Outlook
13,854
Solution 1
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
Solution 2
i just replaced this line and it's worked:
$mail->SMTPSecure = 'ssl';
to this:
$mail->SMTPSecure = 'tls';
Author by
Omar Krichen
Updated on June 26, 2022Comments
-
Omar Krichen almost 2 years
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();
-
Omar Krichen almost 6 yearsi modified $mail->SMTPSecure = 'tls'; and it s worked. Thanks !!
-
Nauman Moazzam almost 6 yearsWell, Glad to help. Your Welcome!!
-
ThorSummoner over 3 yearsequivalent constants are
'ssl'
akaPHPMailer::ENCRYPTION_SMTPS
,tls
akaPHPMailer::ENCRYPTION_STARTTLS
, calling tls starttls is hugely misleading, unless 'tls' isn't tls and is actually starttls...