Setting up PHPMailer with Office365 SMTP

后端 未结 6 1827
盖世英雄少女心
盖世英雄少女心 2020-12-06 11:01

I am attempting to set up PHPMailer so that one of our clients is able to have the automatically generated emails come from their own account. I have logged into their Offic

6条回答
  •  太阳男子
    2020-12-06 11:45

    Try this, it works fine for me, i have been using this for so long

    $mail = new PHPMailer(true);
    $mail->Host = "smtp.office365.com";
    $mail->Port       = 587;
    $mail->SMTPSecure = '';
    $mail->SMTPAuth   = true;
    $mail->Username = "email";   
    $mail->Password = "password";
    $mail->SetFrom('email', 'Name');
    $mail->addReplyTo('email', 'Name');
    $mail->SMTPDebug  = 2;
    $mail->IsHTML(true);
    $mail->MsgHTML($message);
    $mail->Send();
    

提交回复
热议问题