打开etc目录下的php.ini文件,并找到"mail function"

对于windows操作系统,应确保SMTP和sendmail_from都提供。

[mail function]
; For Win32 only.
SMTP = smtp.secureserver.net
; For win32 only
sendmail_from = webmaster@tutorialspoint.com

linux系统只需要设置sendmail_path

[mail function]
; For Win32 only.
SMTP = 
; For win32 only
sendmail_from = 
; For Unix only
sendmail_path = /usr/sbin/sendmail -t -i

配置好后,我们就可以使用php mail()函数了。

收藏 打印