-->

Outlook SMTPClient server error 5.3.4 5.2.0

2020-08-13 06:18发布

问题:

I have an MVC .NET web application that has been running stable for the most part of a year now. However today we received an error code and I'm having trouble finding how to resolve the issue.

In the application, I use SMTPClient to send emails out. For this, we use an Outlook email account. This was working fine until today. The error code that I get is this:

Mailbox unavailable. The server response was: 5.3.4 554-554 5.2.0 STOREDRV.Deliver; delivery result banner

Here is the code that I use in my application.

var client = new SmtpClient
{
    Host = WebConfigurationManager.AppSettings["EmailHost"],
    Port = 587,
    EnableSsl = true,
    DeliveryMethod = SmtpDeliveryMethod.Network,
    UseDefaultCredentials = false,
    Credentials = new System.Net.NetworkCredential(WebConfigurationManager.AppSettings["EmailSender"],
    WebConfigurationManager.AppSettings["EmailSenderPassword"])
};

WebConfigurationManager.AppSettings["EmailHost"], is set to smtp.live.com in the webconfig.

After this, I add data and the other information needed of course, but I omitted that. The error is thrown when we arrive at the last part of the code: client.Send(mail);

Things I have tried so far that did not work.

  • Login to the email account on outlook.live.com;
  • Update security settings on outlook.live.com for the email account;
  • Changed smtp.live.com to smtp-mail.outlook.com;
  • Changed the Port to 25 (which gave me the same error) and 465 (Which gave me a server not reached error);
  • Set EnableSsl to false (Client doesn't work when I do that).

I have seen several posts on SO and other websites that are similar or have the same error code. But they either go unanswered or they mark logging in to the email account as the solution, which does not work for me.

When we logged into the email account we got an update notice from Microsoft talking about the new privacy and security update. This was from September 16th. I don't know if there is a three-month time limit within which you need to agree to it. But a week ago the email account has sent an email, and yesterday it failed on sending one. We agreed to the agreement pop up but it is still not working though.

Does anybody have any idea what I can try now or what is causing this error?

回答1:

OK, I resolved this issue on my system as follows:

i was sending the message with a different email address to that of the account I was sending from like this:

string from = "email@somwhere.com";

so I changed it to :

string from = "thecorrectemailaddress@outlook.com";

so now it works fine ... happy days

MailMessage mail = new MailMessage(from, to);


回答2:

The response of a 5.2.0 STOREDEV is because of the SPF on an email server. https://en.wikipedia.org/wiki/Sender_Policy_Framework

What happened here is that when you sent an email from email@somwhere.com your email server attempts to authenticate that the email was legitimate. So it asks somwhere.com what IPs are allowed to send emails claiming to be from somwhere.com, since you don't own somwhere.com it told your email client that it was fraudulent, and your email client rejected it outright as spam.

So when you changed the email to be ...@outlook.com outlook's SPF didn't reject it as spam, and it went through successfully.



回答3:

I have resolved this issue on my system as follows: The from address should be like these below emails- 1. "thecorrectemailaddress@outlook.com" 2. "thecorrectemailaddress@hotmail.co.uk" Here I am using "smtp.live.com" as server domain and port is 587. If there is any problem with the firewall , you can add a rule in your firewall for the same port 587.