嗨,我曾经使用 ajax 将值传递给名为 test.php 的 php 文件以联系表单发送邮件,一切正常。
test.php 中的代码
if(mail($to,$subject,$message,$headers))
{
echo "mail sent";
}
else
{
echo "no mail sent";
}
发送邮件时 Ajax 工作正常,当邮件未发送时,我收到mail sent
消息,我应该收到no mail sent
。但我不是一个人,我得到一堆错误代码
<br />
<font size='1'><table class='xdebug-error xe-warning' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Warning: mail(): SMTP server response: 551 User not local. We don't relay in E:\wamp1\wamp\www \test.php on line <i>42</i></th></tr>
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
<tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0007</td><td bgcolor='#eeeeec' align='right'>275552</td><td bgcolor='#eeeeec'>{main}( )</td><td title='E:\wamp1\wamp\www\wp_twentythirteen\wp-admin\admin-ajax.php' bgcolor='#eeeeec'>..\admin-ajax.php<b>:</b>0</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>2</td><td bgcolor='#eeeeec' align='center'>0.2273</td><td bgcolor='#eeeeec' align='right'>20765536</td><td bgcolor='#eeeeec'>do_action( )</td><td title='E:\wamp1\wamp\www\wp_twentythirteen\wp-admin\admin-ajax.php' bgcolor='#eeeeec'>..\admin-ajax.php<b>:</b>72</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>3</td><td bgcolor='#eeeeec' align='center'>0.2273</td><td bgcolor='#eeeeec' align='right'>20767104</td><td bgcolor='#eeeeec'><a href='http://www.php.net/function.call-user-func-array' target='_new'>call_user_func_array</a>
( )</td><td title='E:\wamp1\wamp\www\wp_twentythirteen\wp-includes\plugin.php' bgcolor='#eeeeec'>..\plugin.php<b>:</b>406</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>4</td><td bgcolor='#eeeeec' align='center'>0.2273</td><td bgcolor='#eeeeec' align='right'>20767136</td><td bgcolor='#eeeeec'>contact_ajax( )</td><td title='E:\wamp1\wamp\www\wp_twentythirteen\wp-includes\plugin.php' bgcolor='#eeeeec'>..\plugin.php<b>:</b>406</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>5</td><td bgcolor='#eeeeec' align='center'>0.2273</td><td bgcolor='#eeeeec' align='right'>20767312</td><td bgcolor='#eeeeec'><a href='http://www.php.net/function.mail' target='_new'>mail</a>
( )</td><td title='E:\wamp1\wamp\www \test.php' bgcolor='#eeeeec'>..\test.php<b>:</b>42</td></tr>
</table></font>
"no mail sent"
在最后一行我收到此no mail sent
消息。为什么会发生这些。我不想单独发送邮件。谁能帮忙