无法向电子邮件发送消息

发布于 2024-11-10 00:22:56 字数 956 浏览 4 评论 0原文

我在服务器上发送消息时遇到问题。但在我本地,我可以使用免费的 smtp 服务器向电子邮件发送消息。

也许存在防火墙或电子邮件策略不接受本地主机?

请指教..谢谢!

代码:

//send email
MailMessage objEmail = new MailMessage(new MailAddress(ConfigurationManager.AppSettings["emailAdd"].ToString()), new MailAddress(ConfigurationManager.AppSettings["emailAdd"].ToString()));
objEmail.Subject = "Test";
objEmail.Body = _Message;
objEmail.Priority = MailPriority.High;
SmtpClient SmtpMail = new SmtpClient();
SmtpMail.Host = "localhost";
SmtpMail.Send(objEmail);

错误:

System.Net.Mail.SmtpFailedRecipientException:邮箱不可用。服务器响应为:5.7.1 无法中继[电子邮件受保护] 在System.Net.Mail.SmtpTransport.SendMail(MailAddress发件人,MailAddressCollection收件人,字符串deliveryNotify,SmtpFailedRecipientException&异常) 在 System.Net.Mail.SmtpClient.Send(MailMessage 消息)

I having problem on sending message on the server. But in my local I can send message to the emails using the free smtp server.

Maybe there's a firewall or localhost is not accepted in the email policy?

Please advise.. thanks!

Code:

//send email
MailMessage objEmail = new MailMessage(new MailAddress(ConfigurationManager.AppSettings["emailAdd"].ToString()), new MailAddress(ConfigurationManager.AppSettings["emailAdd"].ToString()));
objEmail.Subject = "Test";
objEmail.Body = _Message;
objEmail.Priority = MailPriority.High;
SmtpClient SmtpMail = new SmtpClient();
SmtpMail.Host = "localhost";
SmtpMail.Send(objEmail);

Error:

System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: 5.7.1 Unable to relay for [email protected]
at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception)
at System.Net.Mail.SmtpClient.Send(MailMessage message)

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

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

发布评论

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

评论(2

等往事风中吹 2024-11-17 00:22:56

这个 博客文章回答了基本相同的问题。假设您通过 IIS SMTP 服务器发送,您可能需要修改中继限制以允许从您的 IP 地址进行中继。

This blog post answers basically the same question. Assuming you are sending through the IIS SMTP server, you may need to modify the Relay Restrictions to allow relaying from your IP address.

吲‖鸣 2024-11-17 00:22:56

一些检查:

  1. 如果使用,请检查您的代理是否未被阻止
  2. 检查您的服务器 IP 是否在白名单中,是否在邮件服务器上维护
  3. 在邮件服务器上,检查是否不需要密码
  4. Smtp 服务器地址是否正常

Few checks:

  1. Check if your proxy is not blocked if using
  2. Check that your server IP is in white-list, if it is being maintained on mail server
  3. On mail server check if no password is required
  4. Smtp server address is fine
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文