用代码而不是配置来配置Elmah电子邮件设置 [英] Configure Elmah email settings in code rather than config

查看:227
本文介绍了用代码而不是配置来配置Elmah电子邮件设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设置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在ErrorMailModule 方法rel = nofollow noreferrer>在Google网上论坛上的讨论。

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆