2011-12-29 103 views
0

我使用這種編碼發送郵件使用Gmail,但我得到以下錯誤,在這裏,當我刪除SSL部分,其工作,但我dint收到任何電子郵件(也檢查垃圾郵件也)。還有其他問題嗎?SMTP Gmail服務器SSL錯誤

$mail = new phpmailer; 
$mail->IsSMTP(); // telling the class to use SMTP 
$mail->SMTPDebug = 1;// enables SMTP debug information (for testing) 
$mail->SMTPAuth = true; // enable SMTP authentication 
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier 
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server 
$mail->Port = 465; // set the SMTP port for the GMAIL server 
$mail->Username = "un"; // GMAIL username 
$mail->Password = "pwd"; // GMAIL password 
$mail->SetFrom('[email protected]', 'Bharanidharan'); 
$mail->AddReplyTo("[email protected]","Vishal Kumar"); 
$mail->AddAddress("[email protected]","Bharani"); 
$mail->Subject = "Hey, check out"; 
$body = "hey, check email"; 
$mail->MsgHTML($body); 
$address = "[email protected]"; 
$mail->AddAddress($address, "test"); 
if(!$mail->Send()) 
{ 
echo "Mailer Error: " . $mail->ErrorInfo; 
} 
else 
{ 
echo "Message has been sent"; 
} 
+1

哪裏是實際的錯誤信息? – 2011-12-29 14:01:18

+0

SMTP - >錯誤:無法連接到服務器:無法找到套接字傳輸「ssl」 - 您忘記配置PHP時啓用它嗎? (72165504) SMTP錯誤:無法連接到SMTP主機。郵件程序錯誤:SMTP錯誤:無法連接到SMTP主機。 – DON 2011-12-29 14:24:42

回答

2

啓用的Apache mod_ssl的(搜索配置文件)和OpenSSL的PHP​​擴展(檢查php.ini中)

相關問題