I have code that relies heavily on email notification. In my web.config I am able to specify an smtp server like this:
<system.net>
<mailSettings>
<smtp from="[email protected]">
<network host="mail.mydomain.com" port="25" userName="myusername" password="mypassword" defaultCredentials="true"/>
</smtp>
</mailSettings>
</system.net>
This is acceptable, but I would like to implement 2 or 3 exchange servers here in the event that (for what ever reason) smtp server 1 goes offline, I need a backup option.
Is there any quick / built in way to achieve this fail safe in .net, or is there a trusted manual way to implement this. My existing send mesage code looks like this (but watered down):
MailMessage message = new MailMessage();
SmtpClient client = new SmtpClient();
client.Send(message);
Notice its pulling the host directly from the configuration.
Any ideas what is best practice here for this scenario?