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?
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:
so I changed it to :
so now it works fine ... happy days