這是我的代碼:PHP的郵件不能正常工作
if (mail('[email protected]','New booking', $_REQUEST['message'])) {
echo"<p>Thanks for your booking!</p>";
} else {
echo"<p>Booking failed, please call us to book...</p>";
}
但不斷出現預訂失敗。我的服務器是centos vps。
/usr/local/lib/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 =
所以我改成了這樣:
[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 = "/usr/sbin/sendmail -t -i"
這仍然無法正常工作,現在我出來的想法。每次編輯完php.ini後,我重新啓動服務器
sendmail在'/ var/log/messages'中發現錯誤你有沒有什麼用處? – Kleist
消息中沒有內容:/ – user964778