2017-07-02 116 views
-1

Here's the image of the error.無法連接郵件服務器

你好?我希望有人能幫助我。這是問題所在,我發送電子郵件到Gmail的代碼無法使用。我已經安裝了hMailServer,但我不知道如何配置它。

任何幫助將不勝感激,非常感謝。

<?php 
    $to  = '[email protected]'; 
    $subject = 'the subject'; 
    $message = 'hello'; 
    $headers = 'From: [email protected]' . "\r\n" . 
    'Reply-To: [email protected]' . "\r\n" . 
    'X-Mailer: PHP/' . phpversion(); 

    mail($to, $subject, $message, $headers); 
    echo "Message sent!"; 
?> 

回答

0

我沒有使用電子郵件發送目的的Hotmail,但你可以看看 here? 有人說,hotmail的SMTP端口是。

您的PHP錯誤信息與可能錯誤設置的SMTP端口連接,默認情況下爲。

您必須打開php.ini文件(我可以看到你正在使用WAMP的服務器,所以點擊在托盤> PHP> php.ini文件的圖標),並找到這樣合適的配置項:

[mail function] 
; For Win32 only. 
; http://php.net/smtp 
SMTP = localhost 
; http://php.net/smtp-port 
smtp_port = 25 

然後,只需嘗試在配置中設置smtp_port = 587,然後重新啓動 WAMP服務器。