2012-07-09 34 views
0

我已經下面的代碼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文件「擴展= p​​hp_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)。如何可能?

誰能幫助?

+0

類似的一個,這是否幫助:: http://stackoverflow.com/questions/10813048/error-unable-to-find-the-socket-transport- SSL與 - Zend的郵件使用 – 2012-07-09 07:18:36

回答

0
$mail->SMTPSecure = "ssl"; 

我有這個問題。檢查您的PHPMailer的版本是最新的最新

+0

IM PHPMailer的-0.9 – 2012-07-09 07:19:24

0

這意味着,無論您的SSL模塊沒有正確編譯或編譯它,但它不是通過php.ini配置文件中啓用。

檢查您的設置,以確保您有它啓用。

+0

很抱歉,但沒有得到üexactly.what做ü意思「SSL模塊不請編譯」? – 2012-07-09 07:23:40

+0

我已經在php.ini文件中啓用了extension = php_openssl.dll – 2012-07-09 07:30:46