How do I use the DLL App.Config Hack for Mail Host Settings

梦想的初衷 提交于 2019-12-11 10:08:35

问题


This was from this question but I was told to ask a new one > [Equivalent to 'app.config' for a library (DLL)

Basically I am converting a console app to a DLL and I want to use config settings. They are saying to use an XML file (although I cannot get it to work - all strings come back as blank) but despite that I want to know how to replicate things like Mail Settings.

So how would I go about replicating thing like mail settings e.g

<system.net>
  <mailSettings>
    <smtp>
      <network host="generic.smtp.local"/>
    </smtp>
  </mailSettings>
</system.net>

In an XML file that is just values not actually config for anything. Do I just need to pass these mail settings in manually to each call of a SendEmail method or can they be reproduced in a similar way as it would be good to keep all settings in one config file.

Thanks

来源:https://stackoverflow.com/questions/25138788/how-do-i-use-the-dll-app-config-hack-for-mail-host-settings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!