解决windows系统下php.ini邮件配置正确也不发送邮件的问题
Warning: mail() [function.mail]: SMTP server response: 530 5.7.0 Must issue a STARTTLS command first
php mail()函数在windows不能用,需要安装sendmail
1.从http://glob.com.au/sendmail/下载sendmail.zip
2.解压到C:下,例如C:\php\sendmail,最好短路径,长路径名有可能产生问题。
3.修改php.ini如下
sendmail_path = "C:\wamp\sendmail\sendmail.exe -t"
4.根据你自己的配置环境修改sendmail.ini。
第一次最好启用debug.log_file,error_logfile,以查看sendmail是否生效。
5.重启apache
1.从http://glob.com.au/sendmail/下载sendmail.zip
2.解压到C:下,例如C:\php\sendmail,最好短路径,长路径名有可能产生问题。
3.修改php.ini如下
sendmail_path = "C:\wamp\sendmail\sendmail.exe -t"
4.根据你自己的配置环境修改sendmail.ini。
第一次最好启用debug.log_file,error_logfile,以查看sendmail是否生效。
5.重启apache
用sendmail结合其它的smtp服务器,如smtp.163.com来实现发邮件。现在大部分邮箱都要求smtp验证,所以要在sendmail.ini中加入用户名和密码。
php.ini配置 (以用163邮箱为例)
[mail function]
; For Win32 only.
SMTP = smtp.163.com
smtp_port = 25
; For Win32 ……
php.ini配置 (以用163邮箱为例)
[mail function]
; For Win32 only.
SMTP = smtp.163.com
smtp_port = 25
; For Win32 ……
用sendmail结合其它的smtp服务器,如smtp.163.com来实现发邮件。现在大部分邮箱都要求smtp验证,所以要在sendmail.ini中加入用户名和密码。
php.ini配置 (以用163邮箱为例)
[mail function]
; For Win32 only.
SMTP = smtp.163.com
smtp_port = 25
; For Win32 only.
sendmail_from = 4u4v@163.com
; For Unix only. You may supply arguments as well (default: “sendmail -t -i”).
sendmail_path = “D:\xampp\sendmail\sendmail.exe -t”
就配置三项,smtp、smtp_port和sendmail_path
sendmail.ini配置
[sendmail]
; you must change mail.mydomain.com to your smtp server
smtp_server=smtp.163.com
smtp_port=25
auth_username=yourusername
auth_password=yourpassword
force_sender=yourusername@163.com
sendmail网上有下的,如果你是用xampp,那里面直接就带了。
同时在虚拟主机的conf里加上这样一句
php_admin_value sendmail_path ‘D:\xampp\sendmail\sendmail.exe -t 4u4v@163.com’
此邮件地址为用户的邮件地址,随便添。
原文来源:http://s.yanghao.org/program/viewdetail.php?i=39709php.ini配置 (以用163邮箱为例)
[mail function]
; For Win32 only.
SMTP = smtp.163.com
smtp_port = 25
; For Win32 only.
sendmail_from = 4u4v@163.com
; For Unix only. You may supply arguments as well (default: “sendmail -t -i”).
sendmail_path = “D:\xampp\sendmail\sendmail.exe -t”
就配置三项,smtp、smtp_port和sendmail_path
sendmail.ini配置
[sendmail]
; you must change mail.mydomain.com to your smtp server
smtp_server=smtp.163.com
smtp_port=25
auth_username=yourusername
auth_password=yourpassword
force_sender=yourusername@163.com
sendmail网上有下的,如果你是用xampp,那里面直接就带了。
同时在虚拟主机的conf里加上这样一句
php_admin_value sendmail_path ‘D:\xampp\sendmail\sendmail.exe -t 4u4v@163.com’
此邮件地址为用户的邮件地址,随便添。
推荐阅读
分类:
服务器运维
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构