title: Testing the availability of an smtp mail server using c#
body: <p>I have an MVC3 web application written in C#. I am using McvMailer to send emails from within the application, which is all working fine. </p>
  
  <p>The issue i have is that our smtp server is not anywhere near the web server that will be hosting the application, and that it is possible that on occasion the smtp server may not be available.</p>
  
  <p>I need to be able to detect whether or not the smtp server is available before giving a user the option to send emails. Thus far the best i have come up with is to ping the smtp server using the solution from @John Leidegren answer in <a href="https://stackoverflow.com/questions/614336/check-if-a-server-is-available">this</a> post.</p>
  
  <p>However, it appears that the router is responding to the ping and not the smtp server. Baring in mind that the main cause for the server not being available would be the internet connection failing, i could probably live with this solution if i had to, but it would be nice if i could ensure the availability of the smtp service prior to attempting to send emails.</p>
  
  <p>Any ideas?</p>