【发布时间】:2014-11-04 08:07:37
【问题描述】:
您好,我如何配置我的 php 邮件程序以使其与这些设置一起使用?
我尝试修复用户名和密码,但仍然出现此错误 PHPMailer 错误:以下发件人地址失败:thesis@thesis.buybrand.com.ph :在未连接的情况下调用 Mail()
<?php
require 'class.phpmailer.php';
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Mailer = 'smtp';
$mail->SMTPAuth = true;
$mail->Host = 'gowebph.gowebph.com'; // "ssl://smtp.gmail.com" didn't worked
$mail->Port = 465;
$mail->SMTPSecure = 'tls';
// or try these settings (worked on XAMPP and WAMP):
// $mail->Port = 465;
// $mail->SMTPSecure = 'ssl';
$mail->Username = "thesis@thesis.buybranded.com.ph";
$mail->Password = "XXXXXXXXXXXXXX";
$mail->IsHTML(true); // if you are going to send HTML formatted emails
$mail->SingleTo = true; // if you want to send a same email to multiple users. multiple emails will be sent one-by-one.
$mail->From = "thesis@thesis.buybranded.com.ph";
$mail->FromName = "Your Name";
$mail->addAddress("vince_agno@live.com","User 1");
$mail->addAddress("2009010067@ust-ics.mygbiz.com","User 2");
$mail->Subject = "Testing PHPMailer with localhost";
$mail->Body = "Hi,<br /><br />This system is working perfectly.";
if(!$mail->Send())
echo "Message was not sent <br />PHPMailer Error: " . $mail->ErrorInfo;
else
echo "Message has been sent";
?>
【问题讨论】:
-
尝试添加$mail->SMTPDebug = 4;启用详细调试输出。这可能会给你一个提示。