如何修复警告:mail() [function.mail]:SMTP 服务器响应:需要 530 SMTP 身份验证.在 C:\xampp\htdocs\.. 第 22 行错误 [英] How to fix Warning: mail() [function.mail]: SMTP server response: 530 SMTP authentication is required. in C:\xampp\htdocs\.. on line 22 ERROR

查看:67
本文介绍了如何修复警告:mail() [function.mail]:SMTP 服务器响应:需要 530 SMTP 身份验证.在 C:\xampp\htdocs\.. 第 22 行错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 PHP 新手,并以在线脚本为例.我已经设置了 Xampp,并且 php 已安装并正常工作.我尝试使用 hMailServer 设置本地邮件服务器,但是我不确定这是否设置正确.无论如何,这是 PHP 代码:

I'm new to PHP and have taken a script as an example online. I have setup Xampp and the php is installed and working. I've attempted to setup a local mailserver with hMailServer, however I'm not entirely sure if that's setup correctly. Anyhow, here's the PHP code:

<?php

$subject="";
$detail="";
$customer_mail="";
$name="";

// Contact subject
$subject ="$subject"; 

// Details
$message="$detail";

// Mail of sender
$mail_from="$customer_mail"; 

// From 
$header="from: $name <$mail_from>";

// Enter your email address
$to ='sean.myers92@gmail.com';
$send_contact=mail($to,$subject,$message,$header);

// Check, if message sent to your email 
// display message "We've recived your information"
if($send_contact){
echo "We've recived your contact information";
}
else {
echo "ERROR";
}
?>

以及对应的HTML代码:

And the corresponding HTML code:

<table width="400" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td><strong>Contact Form </strong></td>
</tr>
</table>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td><form name="form1" method="post" action="test.php">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td width="16%">Subject</td>
<td width="2%">:</td>
<td width="82%"><input name="subject" type="text" id="subject" size="50"></td>
</tr>
<tr>
<td>Detail</td>
<td>:</td>
<td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>
</tr>
<tr>
<td>Name</td>
<td>:</td>
<td><input name="name" type="text" id="name" size="50"></td>
</tr>
<tr>
<td>Email</td>
<td>:</td>
<td><input name="customer_mail" type="text" id="customer_mail" size="50"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>

当我提交表单时,我收到错误警告:mail() [function.mail]:SMTP 服务器响应:需要 530 SMTP 身份验证.任何想法可能是错误的?谢谢

When I submit the form I get the error Warning: mail() [function.mail]: SMTP server response: 530 SMTP authentication is required. Any ideas what could be wrong? Thanks

推荐答案

来自 hMailServer 论坛:http://www.hmailserver.com/forum/viewtopic.php?f=6&t=22039

From the forums of hMailServer: http://www.hmailserver.com/forum/viewtopic.php?f=6&t=22039

关于 IP 范围.转到我的电脑 IP 范围并取消本地到外部和/或外部到外部的身份验证.

On the IP ranges. goto the my computer ip range and untick authentication for local to external and/or external to external.

这篇关于如何修复警告:mail() [function.mail]:SMTP 服务器响应:需要 530 SMTP 身份验证.在 C:\xampp\htdocs\.. 第 22 行错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆