如何修复警告:mail() [function.mail]:SMTP 服务器响应:需要 530 SMTP 身份验证。在 C:\xampp\htdocs\.. 第 22 行错误

Sea*_*ers 2 php xampp mail-server

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

<?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";
}
?>
Run Code Online (Sandbox Code Playgroud)

以及相应的 HTML 代码:

<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>
Run Code Online (Sandbox Code Playgroud)

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

小智 5

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

在 IP 范围内。转到我的电脑 ip 范围并取消本地到外部和/或外部到外部的身份验证。