我已經下面的代碼smtp_error:無法連接到服務器
phpinfo();
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com"; // SMTP server
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->Username= '[email protected]';
$mail->Password='xxx';
$mail->From = "[email protected]";
$mail->AddAddress("[email protected]");
$mail->Subject = "First PHPMailer Message";
$mail->Body = "Hi! \n\n This is my first e-mail sent through PHPMailer.";
$mail->WordWrap = 50;
if(!$mail->Send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent.';
}
我也能在php.ini文件「擴展= php_openssl.dll」 ..
但還是它給我一個錯誤,
Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.gmail.com:465 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?)
Mailer error: SMTP Error: Could not connect to SMTP host.
雖然我已經在我的php.ini文件中啓用extension=php_openssl.dll
,phpinfo()函數;顯示OpenSSL support:disabled (install ext/openssl)
。如何可能?
誰能幫助?
類似的一個,這是否幫助:: http://stackoverflow.com/questions/10813048/error-unable-to-find-the-socket-transport- SSL與 - Zend的郵件使用 – 2012-07-09 07:18:36