我无法使用PHP发送电子邮件。你能看到我的代码中有任何问题吗?PHP中的邮件功能问题
php.ini的邮件设置:
[mail function]
SMTP = mail.ntserv.co.in
smtp_port = 26
代码:
<?php
$to = "[email protected]";
$subject = "Test mail";
$message = "hi, How r u";
$from = "[email protected]";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
输出:
Warning: mail() [function.mail]: SMTP server response: 551 This mail server requires authentication before sending mail from a locally hosted domain. Please reconfigure your mail client to authenticate before sending mail. in C:\xampp\htdocs\vijay\demo\msg.php on line 7 Mail Sent.
稍微详细一点会有帮助 - 例如,您是收到错误消息还是仅收不到电子邮件? – cori 2009-11-06 02:23:53
恩,看起来好像你正尝试使用gmail的服务器从你自己的脚本发送一封电子邮件。这是不可能的,肯定是...... – Mathew 2009-11-06 02:26:20
先生,科里, 现在我编辑的代码。 错误:表示像这样 警告:邮件()[function.mail]:SMTP服务器响应:551此邮件服务器从本地托管域发送邮件之前需要验证。在发送邮件之前请重新配置您的邮件客户端进行身份验证。在C:\ XAMPP \ htdocs中\维杰\演示\上线msg.php 7 邮件发送。 – kumar 2009-11-06 03:26:58