所以,我下載並安裝了smtp4dev。如何配置php.ini以使用smtp4dev?
當我嘗試在我的PHP文件發送郵件:
mail('localhost', "Hey there", "no");
我從php.ini中的錯誤,抱怨宣佈sendmail_from心不是。
我想它聲明:
sendmail_from = [email protected]
這使得PHP的沉默,但仍然不起作用 - 嘗試加載網頁30秒,然後另一個錯誤。致命錯誤:超過30秒的最大執行時間。
我該如何配置php.ini才能正常工作?
的php.ini
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = [email protected]
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
;sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =
; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = Off
; Log all mail() calls including the full path of the script, line #, to address and headers
;mail.log = "C:\xampp\apache\logs\php_mail.log"
'smpt_server'? –
我的意思是smtp_server,謝謝 –
這個變量在'php.ini'中不存在。沒有'smtp_server'變量。正確的變量簡單地稱爲'SMTP'你的答案中已經提到了。 –