用代码而不是配置来配置Elmah电子邮件设置 [英] Configure Elmah email settings in code rather than config
问题描述
我正在设置Elmah电子邮件,并且不想将我的电子邮件帐户凭据放在web.config中。
I'm setting up Elmah emails and I don't want to put my email account credentials in web.config.
我正在Azure上进行部署,因此希望在应用启动时在代码中从Azure应用设置中查找凭据。
I'm deploying on Azure and therefore would like to look up the credentials from Azure app settings in code on app startup.
是否可以通过代码而不是使用< errorMail>声明性地配置Elmah电子邮件;标记?
Is there a way to configure Elmah emails declaratively in code rather than using the <errorMail> tag?
推荐答案
最好的方法是覆盖 SendMail
Atm Aziz在
The best way to do this is by overriding the SendMail
method of Elmah's ErrorMailModule
, as suggested by Atif Aziz in this discussion on Google Groups.
我在此答案。
这篇关于用代码而不是配置来配置Elmah电子邮件设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!