SMTP 服务器响应:550 简单电子邮件功能的收件人无效
我正在使用 php 创建一个网站,通过电子邮件发送确认消息..
编辑我的 php.ini,我按照以下演练操作:
http://php.net/manual/en/ref.mail.php
我下载了一个免费的 smtp 服务器来测试连接,我使用端口 25,并将 DNS 服务器作为本地主机。我使用此服务器来测试我发送的电子邮件是否正在连接
我使用这个简单的代码来测试 mail() 函数:
<?php
$to = '[email protected]';
$subject = 'the subject';
$from = '[email protected]';
$message = 'hello';
if(mail($to, $subject, $message, "From: $from"))
echo "Mail sent";
else
echo "Mail send failure - message not sent"; ?>
运行时,smtp 服务器指示当前活动连接是“[电子邮件受保护]"。
但网站显示此错误消息:
SMTP 服务器响应:550 无效收件人
我该怎么办?我对开发非常陌生,第一次使用 smtp,所以我不知道发生了什么
PS。我这里有 smtp 服务器> softstack.com/freesmtp.html
i am creating a website using php that sends confirmation messages through emails..
to edit my php.ini, i followed this walkthrough:
http://php.net/manual/en/ref.mail.php
i downloaded a free smtp server to test the connections, i used port 25, and the DNS server as localhost. I use this server to test if the email i send is being connected
i used this simple code to test the mail() function:
<?php
$to = '[email protected]';
$subject = 'the subject';
$from = '[email protected]';
$message = 'hello';
if(mail($to, $subject, $message, "From: $from"))
echo "Mail sent";
else
echo "Mail send failure - message not sent"; ?>
when running, the smtp server indicates that the current active connection is the "[email protected]".
but the website shows this error message:
SMTP server response: 550 Invalid recipient
what should i do? i am very new to development and used smtp for the first time so i have no idea what is happening
PS. I got the smtp server here> softstack.com/freesmtp.html
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为了进行测试,您可以尝试这个工具,称为测试邮件服务器工具。它的优点是不发送实际的电子邮件,从而向您的帐户发送垃圾邮件,而是在桌面上保存/打开电子邮件,这与本来要发送的电子邮件相同。您可以通过这种方式检查标头并更轻松、更快地进行调试。请注意,它在生产和远程测试中没有用。它不是为此目的的。
For testing you could try this tool, called Test Mail Server Tool, instead. It has the benefit of not sending actual emails thus spamming your account, but saving/opening the email on your desktop, the same email which would have been sent. You can examine the headers this way and debug more easily and much faster. Note that it's useless in production, and testing remotely. It was not meant for that.
从内部引号中删除请求标头中的
$from
并尝试使用有效的电子邮件地址。Remove
$from
in request header from inside quotes and try using a valid email address.