0

I have to used Multiple smtp detail in web.config file, may I used like this and how i can access different smtp for different purposes. I want to used first smtp for logging error. and second for successful mail to users.

Example

<system.net>
<mailSettings>
   <smtp deliveryMethod="Network" from="test@gmail.com">
    <network defaultCredentials="false" host="smtp.gmail.com" port="587" userName="test@gmail.com" password="test"/>
  </smtp>

 <smtp deliveryMethod="Network" from="tes2t@gmail.com">
    <network defaultCredentials="false" host="smtp.gmail.com" port="587" userName="tes2t@gmail.com" password="test2"/>
  </smtp>
</mailSettings>

How i can use first smtp for logging and second smtp for success msgs.

  • As far as I know, the above is **not** valid configuration. You can't have multiple `` sections. I suspect that the application will crash with the above. – Oded Dec 10 '12 at 12:52
  • Any other way to access Multiple smtp concept –  Dec 10 '12 at 12:58
  • There are several ways to do this - from writing your own config section to using multiple `appSetting` entries. – Oded Dec 10 '12 at 14:42

1 Answers1

0

You must define multiple section based on System.Net.Configuration.SmtpSection type.
Your answer is here

Community
  • 1
  • 1
Meh Man
  • 463
  • 1
  • 6
  • 22