你好我如何配置我的PHP邮件程序使它能够使用这些设置? 如何根据虚拟主机的邮件账户配置SMTP设置
我试图修复的用户名和密码,但我仍然得到这个错误 PHPMailer的错误:下面的发件人地址失败:[email protected]:[邮件(),而无需连接
<?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 = "[email protected]";
$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 = "[email protected]";
$mail->FromName = "Your Name";
$mail->addAddress("[email protected]","User 1");
$mail->addAddress("[email protected]","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;启用详细的调试输出。这可能会给你一个提示。 – 2014-11-04 08:17:25