2014-11-04 41 views
0

你好我如何配置我的PHP邮件程序使它能够使用这些设置? enter image description here如何根据虚拟主机的邮件账户配置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"; 
?> 
+0

尝试添加$ mail-> SMTPDebug = 4;启用详细的调试输出。这可能会给你一个提示。 – 2014-11-04 08:17:25

回答

1

可否请你用这个

$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only 

$mail->SMTPSecure = 'ssl'; 
$mail->Port = 465; 

或者如果使用TLS尝试使用端口587 TLS

从维基---安全SMTP - 端口587(也可以使用传统端口465 - 这可以解决SSL的问题)(端口587具有可选的TLS加密,可能现在使用STARTTLS,或使用端口465进行SSL加密)