erasmo carlos
erasmo carlos

Reputation: 682

C# how to check what smtp server to use

I am wondering how to check for a smtp server status, and if the server is down, then use a different server.

Currently I create the smtp client this way:

        MailMessage mm = new MailMessage();
        SmtpClient smtp = new SmtpClient("exch1.mail.com");

But a times exch1 is down, we have exch2, exch3, exch4, and exch5.

Is it possible to check for the status and use the first one that is available?

Thank you, Erasmo

Upvotes: 0

Views: 63

Answers (1)

Amogh Sarpotdar
Amogh Sarpotdar

Reputation: 617

You shouldnt be using smtpclient. Check out https://github.com/dotnet/platform-compat/blob/master/docs/DE0005.md

Your question is answered here - Testing SMTP server is running via C#

Upvotes: 1

Related Questions