Send email from Elmah?

后端 未结 3 863
故里飘歌
故里飘歌 2020-12-04 07:05

Is anyone using Elmah to send exceptions via email? I\'ve got Elmah logging set up via SQL Server, and can view the errors page via the Elmah.axd page, but I am unable to ge

相关标签:
3条回答
  • 2020-12-04 07:42

    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.

    0 讨论(0)
  • 2020-12-04 08:02

    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>
    
    0 讨论(0)
  • 2020-12-04 08:04

    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.

    0 讨论(0)
提交回复
热议问题