您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

如何解决php mail错误问题

2024/6/6 8:02:50发布20次查看
php mail错误的解决办法:1、在smtp服务的中继选项中添加本机ip地址;2、在网关做个端口映射,把25端口映射到本机即可。
本文操作环境:windows7系统、php7.1版、dell g3电脑
如何解决php mail错误问题?
php的mail()函数出错的问题
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><title>phpinfo</title></head><body><?$to = "atoat@sina.com";$subject = "php-mail";$msg = "i completely understand smtp servers now!";$headers = "from: atoat@163.com/r/nreply-to: atoat@163.com";mail("$to", "$subject", "$msg", "$headers");echo "finished!";?></body></html>
出现的错误:
warning: mail() [function.mail]: smtp server response: 550 5.7.1 unable to relay for atoat@sina.com in c:/webserver/htdocs/www/mail.php on line 14
php.ini配置情况
[mail function]; for win32 only.smtp = localhostsmtp_port = 25; for win32 only.sendmail_from = atoat@163.com
已经安装了windows自带的smtp服务
找了好久才发现需要在smtp服务的中继选项中添加本机ip地址
虚拟服务器->属性->访问->中继
选择仅以下列表=>单台计算机=>添加127.0.0.1的本地地址
程序没有出现问题,但收件箱中没有立即收到信息.
没有收到是因为我的机子是在内网中,不能把邮件发送到外网.
解决方法:
在网关做个端口映射,把25端口映射到本机.或者本机有公网ip.
推荐学习:《php视频教程》
以上就是如何解决php mail错误问题的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product