php的mail()函数出错的问题
发布时间:2016-10-29 编辑:jiaochengji.com
教程集为您提供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.comrnReply-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:webserverhtdocswwwmail.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.comrnReply-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:webserverhtdocswwwmail.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.
<
您可能感兴趣的文章:
PHPmailer邮件群发的入门例子
PHPMailer发送邮件代码实例(ubuntu系统)
php的mail()函数出错的问题
PHPMailer邮件标题中文乱码的解决方法
phpmailer类实现邮件群发的实例代码
PHPmailer 邮件群发的范例参考
php使用phpMailer发送邮件的例子
PHPMailer邮件类发送邮件举例(163邮箱)
PHP mail() 函数使用方法
PHPMailer发送邮件”SMTP 错误:无法连接到 SMTP 主机“
上一篇:php超级功能,汉字转拼音
下一篇:PHP禁止图片文件的被盗链函数
[关闭]