这是我的代码:
if (mail('email@mail.com','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 = me@example.com
; 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 = me@example.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = "/usr/sbin/sendmail -t -i"
这仍然不起作用,现在我没有想法。每次编辑php.ini后重新启动我的服务器
答案 0 :(得分:0)
您需要在致电From:
时提供mail()
地址。大多数SMTP服务器和sendmail
都需要这样做。
答案 1 :(得分:0)
不确定为什么但是directadmin已经更改了导致它失败的exim文件夹的权限。