Failed to Send Message to Emails

给你一囗甜甜゛ 提交于 2019-12-11 03:27:49

问题


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 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)


回答1:


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.




回答2:


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


来源:https://stackoverflow.com/questions/6156145/failed-to-send-message-to-emails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!