发送邮件时出现问题-使用Outlook邮件PHPMailer时出错

时间:2019-08-22 06:43:06

标签: phpmailer

我在使用以下配置发送邮件时遇到问题。

Error using Outlook mail PHPMailer

代码是:

<?php

ini_set('display_errors', 'On');
error_reporting(E_ALL);
$to="it@yogya.co.in";
require "mailler/class.phpmailer.php";
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->CharSet = 'UTF-8';
$mail->Host = "smtp.live.com";
$mail->SMTPAuth= true;
$mail->Port = 587;
$mail->Username="sonya@yowza.co.in";
$mail->Password="Admin@12345678";
$mail->SMTPDebug = 2;
$mail->SMTPSecure = 'tls';
$mail->From ='sonya@yowza.co.in';
$mail->FromName='yowza';
$mail->isHTML(true);
$mail->Subject = 'test_mail';
$mail->Body ='demo mail';
$mail->addAddress($to);
//$mail->AltBody = "This is the body in plain text for non-HTML mail clients";

if(!$mail->send()){
 echo "Mailer Error: " . $mail->ErrorInfo;
}else{
 echo "E-Mail has been sent";
}
?>

请帮帮我。

0 个答案:

没有答案