2014-01-25 29 views
0

在Network Solutions共享託管軟件包中使用https://github.com/PHPMailer/PHPMailer獲得基本聯繫表。PHP聯繫表與網絡解決方案

// start the mail request basics 
$mail = new PHPMailer(); // create a new object 
$mail->IsSMTP(); // enable SMTP 
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only 
$mail->Debugoutput = 'html'; 
$mail->SMTPAuth = true; // authentication enabled 
$mail->Host = 'ssl://smtp.gmail.com'; 
$mail->Port = 587; 
$mail->IsHTML(true); 
$mail->Username = '[email protected]'; 
$mail->Password = '*******'; 

一切正常本地找(我的電腦上)和形式發送電子郵件,但是當我上傳這個PHP文件到我們的網絡解決方案的託管我碰到下面的錯誤。

SMTP ERROR: Failed to connect to server: Connection timed out (110) 
SMTP connect() failed. 

是不是有什麼毛病我的郵件設置?其他人在Network Solutions Shared Hosting上使用PHP郵件獲得成功?

回答

0

你可以改變你的配置選項。

$mail = new PHPMailer(); 
$mail->IsSMTP(); 
$mail->SMTPDebug = 1; 
$mail->SMTPAuth = true; 
$mail->SMTPSecure = 'ssl'; 
$mail->Host = "smtp.gmail.com"; 
$mail->Port = 587; 
$mail->IsHTML(true); 
$mail->Username = "[email protected]"; 
$mail->Password = "********"; 
$mail->SetFrom("[email protected]"); 
$mail->Subject = "Testing the New Config"; 
$mail->Body = "Hey there !"; 
+0

這是我的初始配置,但得到了相同的響應>無法連接到服務器 – pcasa

1

網絡解決方案阻止發送郵件所需的幾個端口,包括Gmail所需的郵件。

如果有人找到替代品,請告訴我。

現在,使用了一個虛擬帳戶,並使用標準的PHP郵件程序,然後轉發郵件。