我正在使用PHPMailer()类触发邮件。在xampp中工作正常。当我将其托管在Yahoo Small Business中时,它只显示一个空白页面,没有收到邮件。
这是我的PHP文件
<?php
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = "tls";
$mail->Host = "smtp.mail.yahoo.com";
$mail->Port = 587;
$mail->Username = 'xxxxxxxx@yahoo.com';
$mail->Password = 'xxxxxxxx';
$mail->From = "xxxxxxxx@yahoo.com";
$mail->FromName = "Full Name";
$mail->addAddress("xxxxxxxx@yahoo.com");
$mail->addReplyTo("reply@yourdomain.com", "Reply");
$mail->addCC("cc@example.com");
$mail->addBCC("bcc@example.com");
$mail->isHTML(true);
$mail->Subject = "Subject Text";
$mail->Body = "<i>Mail body in HTML</i>";
$mail->AltBody = "This is the plain text version of the email content";
if(!$mail->send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message has been sent successfully";
}
我尝试使用mail()函数,但失败。我遵循了Php mail() vs Yahoo: Can someone Simply Explain Steps required for YAHOO to receive mail from php mail function?并最终遇到此错误。我该如何解决?预先感谢。