php中使用mail()函数不能发邮件怎么办-LMLPHP

原因分析:

mail()函数在windows系统中不能直接使用,需要下载sendmail。

(推荐教程:php图文教程

解决方法:

首先下载sendmail,进行解压,路径自定义,例如:E:\sendmail;

然后在php.ini配置文件中加入以下配置(以163邮箱为例);

[mail function]
SMTP = smtp.163.com
smtp_port = 25
sendmail_from = 4u4v@163.com
sendmail_path = "E:\sendmail\sendmail.exe -t"
登录后复制

(视频教程推荐:php视频教程

然后修改sendmail.ini文件;

smtp_server=smtp.163.com  //这里是配置对应的163的smtp
smtp_port=25
auth_username=username  //邮箱用户名
auth_password=password   //邮箱密码
force_sender=username@163.com //你的邮箱全名 用户名@163.com
登录后复制

完成!

以上就是php中使用mail()函数不能发邮件怎么办的详细内容,更多请关注Work网其它相关文章!

08-31 09:03