无法将消息发送到电子邮件 [英] Failed to Send Message to Emails

查看:88
本文介绍了无法将消息发送到电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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?

请告知..谢谢!

代码:

//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无法为mae@yahoo.com中继在System.Net.Mail.SmtpTransport.SendMail(MailAddress发件人,MailAddressCollection收件人,字符串deliveryNotify,SmtpFailedRecipientException&异常)在System.Net.Mail.SmtpClient.Send(MailMessage消息)

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

推荐答案

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.

这篇关于无法将消息发送到电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆