要檢查/更改你的PHP郵件配置:
打開php.ini文件(如果你不知道這一點,見下文)搜索讀取[郵件功能]行添加/更改您的郵件服務器的詳細信息。這可能是本地郵件服務器或您的ISP的郵件服務器。保存/關閉php.ini文件重新啓動你的web服務器
的郵件設置可能是什麼樣子,當你第一次打開php.ini文件的一個例子:
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
;sendmail_from = [email protected]
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =
附加信息是在呼應phpinfo()
你可以查看你的PHP配置細節。你可以通過創建一個.php文件來做到這一點。當你在瀏覽器中運行這個時,你會看到一個完整的PHP配置變量列表。只需搜索包含php.ini和sendmail_path的行即可查看需要使用的值。
另一個想法是,你可以使用ini_set()
正確配置您的郵件設置,這樣
下面的代碼添加到您的電子郵件腳本的頂部,如果你的郵件腳本仍然失敗。
// Please specify your Mail Server - Example: mail.example.com.
ini_set("SMTP","mail.example.com");
// Please specify an SMTP Number 25 and 8889 are valid SMTP Ports.
ini_set("smtp_port","25");
// Please specify the return address to use
ini_set('sendmail_from', '[email protected]');
Ini_set修復了問題;謝謝! – SomeCoder 2013-03-27 00:47:51
很高興聽到..歡迎和快樂的編碼.. – 2013-03-27 00:50:47