php的mail()函数出错的问题
2008-03-30 13:12
246 查看
<!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 = localhost
smtp_port = 25
; For Win32 only.
sendmail_from = atoat@163.com
已经安装了windows自带的smtp服务
找了好久才发现需要在smtp服务的中继选项中添加本机IP地址
虚拟服务器->属性->访问->中继
选择"仅以下列表"=>"单台计算机"=>添加127.0.0.1的本地地址
程序没有出现问题,但收件箱中没有立即收到信息.
没有收到是因为我的机子是在内网中,不能把邮件发送到外网.
解决方法:在网关做个端口映射,把25端口映射到本机.或者本机有公网IP.
<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 = localhost
smtp_port = 25
; For Win32 only.
sendmail_from = atoat@163.com
已经安装了windows自带的smtp服务
找了好久才发现需要在smtp服务的中继选项中添加本机IP地址
虚拟服务器->属性->访问->中继
选择"仅以下列表"=>"单台计算机"=>添加127.0.0.1的本地地址
程序没有出现问题,但收件箱中没有立即收到信息.
没有收到是因为我的机子是在内网中,不能把邮件发送到外网.
解决方法:在网关做个端口映射,把25端口映射到本机.或者本机有公网IP.
相关文章推荐
- PHP经验——usort使用函数中调用引用函数的出错问题
- Windows 7 下安装Smtp的替代方法可以解决php 的mail()函数报错问题()
- Ubuntu中启用php的mail()函数并解决发送邮件速度慢问题
- mail()函数出错的问题
- PHP的mail()函数发送邮件,其中的html标签未被正常解析的问题
- 2010-09-03 19:00 Windows 7 下安装Smtp的替代方法可以解决php 的mail()函数报错问题
- PHP邮件mail()函数解析和SMTP使用方法及乱码问题
- php之mail函数遇到的问题
- PHP正则preg_replace()函数 Unknown modifier 'c'问题 _新手学php正则的时候遇到的问题
- eclipse中使用ctrl无法追踪函数的问题(php项目)
- php使用odbc执行复杂函数遇到的问题,sql语句直接在sqlserver数据库中运行有结果,使用php总是为空
- 关于php加密库加密数据上传数据库或解密出错的问题
- php 中的重载技术——解决调用对象(或类)的未定义的属性或方法出错问题
- PHP常用库函数介绍+常见疑难问题解答
- PHP中exec、system等函数调用linux命令问题
- PHP中使用了mcrypt_decrypt函数处理Json串后导致Json_decode返回null问题
- PHP问题:js中的encodeURIcomponent 函数在php如何实现?
- php的json_encode函数问题
- php时间函数的一些例子以及时区设置问题
- 在服务器上php执行某些远程函数出错