Send email from Elmah?

北慕城南 提交于 2019-11-27 16:59:08
TonyB

You need the ErrorMail httpModule.

add this line inside the <httpModules> section

<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />

If you're using a remote SMTP server (which it looks like you are) you don't need SMTP on the server.

Anand Patel

Yes, if you are not using remote SMTP server you must have SMTP Server configured locally. You can also configure email for elmah in web.config as follows:

<configSections>
   <sectionGroup name="elmah">
     <section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler,  Elmah"> 
    </sectionGroup>
</configSections> 

<elmah> 
     <errorMail from="from Mail Address" to="to mail address" 
                async="true"  smtpPort="0" useSsl="true" /> 
</elmah>

<system.net> 
    <mailSettings> 
      <smtp deliveryMethod ="Network"> 
        <network host="smtp.gmail.com" port="587" userName="yourgmailEmailAddress"   password="yourGmailEmailPassword" /> 
      </smtp> 
    </mailSettings> 
</system.net>

I have used Elmah myself in this configuration and I had to setup the server with SMTP locally. It is a straight-forward install on you local IIS server. This should do the trick.

Good point above, you need the errorMail module BUT if you are not using a remote SMTP server you need SMTP locally, just to clarify.

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