0

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

erasmo carlos
  • 664
  • 5
  • 16
  • 37
  • What if your check shows that exch1 is available, but as soon as you actually try to send the message, it shuts down? – GSerg Jul 01 '22 at 17:22

1 Answers1

1

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#

Amogh Sarpotdar
  • 544
  • 4
  • 15