SMTP:中继错误

发布于 2024-12-27 10:46:19 字数 869 浏览 2 评论 0原文

我正在创建一个电子邮件客户端,它从服务器 ip 而不是 SMTP 发送电子邮件地址,我编写了该代码:

SmtpClient server = new SmtpClient("50.23.128.66");
MailMessage msg = new MailMessage("[email protected]", "[email protected]", "subject", "body");
server.Send(msg);

但是当我运行它时,我收到该错误:

未处理的异常:System.Net.Mail.SmtpFailedRecipientException:邮箱不可用。服务器响应为:5.7.1 中继被拒绝。 在 System.Net.Mail.SmtpTransport.SendMail(MailAddress 发件人,MailAddressColl 接收者、字符串deliveryNotify、SmtpFailedRecipientException&例外)

* 顺便说一句,我正在使用 Windows Server 2008 * 我将 smtp 服务器配置为 localhost 和端口 25,但我不知道依赖错误是什么。

i am creating an email client that sends e-mail address from server ip instead of SMTP , i wrote that code:

SmtpClient server = new SmtpClient("50.23.128.66");
MailMessage msg = new MailMessage("[email protected]", "[email protected]", "subject", "body");
server.Send(msg);

but when i run it , i get that error:

Unhandled Exception: System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: 5.7.1 Relaying Denied.
at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressColl
ection recipients, String deliveryNotify, SmtpFailedRecipientException& exception)

* By the way i am using Windows Server 2008 *
and i configured the smtp server to localhost and port 25 , but i don`t know what is that relying error .

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

↙厌世 2025-01-03 10:46:19

如果您使用本地主机来依赖电子邮件,则应该使用 127.0.0.1 或本地主机,而不是您在代码中发布的 IP 地址。

If you are using you localhost to rely email, you should be using 127.0.0.1 or localhost instead of that ip address you posted in your code.

夜司空 2025-01-03 10:46:19

中继是 SMTP 服务器用来验证它是否应路由来自特定发件人的电子邮件的方法。 “开放中继”意味着无需身份验证,SMTP 服务器将发送任何人发送的电子邮件。这不是一个好的做法,并且此特定 SMTP 服务器上可能有一些机制进行身份验证,例如用户名和密码,甚至发件人的 IP 地址。请咨询 SMTP 服务器的管理员以了解需要什么。我认为至少您需要设置用户名和密码,而您在代码示例中没有这样做。

Relaying is the method the SMTP server uses to authenticate that it should route the email from a particular sender. An "open relay" means that there is no authentication and the SMTP server will send email sent from anyone. This is not a good practice and there are probably some mechanisms on this particular SMTP server to authenticates, such as a user name and password or even the IP address of the sender. Check with the administrator of the SMTP server to see what is required. I would think at a minimum you would need to set the user name and password, which you did not do in your code example.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文