SMTP Remote name could not be resolved

The setup: I've got an email-service with an API. My other applications connects to the api, providing an Email-object. The email-service then sends the email. I've got it in a few applications and it works flawless.

Now I'm implementing it into an older desktop application. Problem:

I'm trying to send an email from office365. This works 50% of the times. The other 50% i get an SMTP-exception saying the following: "The remote name could not be resolved: '' GeneralFailure".

I've tried using as remove server too, it still fails every now and then.

The application connects correctly to the API and I get as far as to sending the email. And pretty often, the exception above occurs.

    SmtpClient SmtpServer = new SmtpClient(creds.SmtpServer);
            SmtpServer.UseDefaultCredentials = false;
            SmtpServer.Port = (int)creds.SmtpPort;
            SmtpServer.Credentials = new System.Net.NetworkCredential(creds.Account, creds.Password);
            SmtpServer.EnableSsl = true;

    using (SmtpServer)
                dbLayer.LoggEmail(email, false, null);
                return true;

Is there anyone with any ideas, thoughts or answers? Its weird it works SOMETIMES.


I've seen this before, basically it's name resolution.

2 common problems:

a)Your machine not being able to correctly connect to the DNS sever or b)DNS server is slow/non-responding.

hth, Dave

telnet over port 25 from your local application server. It should succeed with a banner. If not then get the port 25 unblocked on firewall/network. Try then, it should work.

Need Your Help

How to display a contentItem based on another Items value in orchard

orchardcms orchardcms-1.8

I am trying to figure out a way to say have a checkbox in a page content type that would enable me to hide or show a projection of images based on that box being selected. What would be the best wa...