2014-11-04 40 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加密)