I have a doubt in my web application can i place two nework tags in smtp mailSetting tag.
I PLACED in SMTP two network tags , BUT WHEN I AM SENDING MAIL I AM GETTING THIS ERROR. The element may only appear once in this section. (C:\Inetpub\vhosts\example.com\httpdocs\web.config line 64)
THIS IS MY WEB CONFIG CODE ……
<system.net>
<mailSettings>
<smtp>
<network host="webmail.example.com" port="25" userName="info@example.com" Password="asdf" defaultCredentials="false"/>
<network host="webmail.yyy.com" port="25" userName="info@yyy.com" Password="asdf254" defaultCredentials="false"/>
</smtp>
</mailSettings>
You can use the AppSettings section and add as many configuration values as you like. You can use for example:
and then in your code decide which server to use.