您好我如何配置我的PHP邮件使其适用于这些设置?
我试图修复用户名和密码,但我仍然收到此错误 PHPMailer错误:以下发件人地址失败:thesis@thesis.buybranded.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";
?>
答案 0 :(得分:1)
你已经拥有了你的端口&amp;协议不匹配。端口465用于ssl,端口587用于tls。 见https://support.google.com/mail/answer/13287?hl=en
答案 1 :(得分:1)
请你用这个
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
也
$mail->SMTPSecure = 'ssl';
$mail->Port = 465;
或者如果使用TLS尝试将端口587用于TLS
来自wiki ---安全SMTP - 端口587(也可以使用传统端口465 - 这可以解决SSL问题)(端口587具有可选的TLS加密,可能现在使用STARTTLS,或使用端口465进行SSL加密)