Send a private message to Elmah

Does anyone use Elmah to send exceptions via email? I have Elmah registration through SQL Server and you can view the error page through the Elmah.axd page, but I cannot get the email component to work. The idea here is to receive an email notification so that we can respond to exceptions more quickly. Here is my web.config (unnecessary sections omitted), while all sensitive data is replaced with * * * *. Although I specify the server to connect to, do I need the SMTP service on the local machine?

<?xml version="1.0"?> <configuration> <configSections> <sectionGroup name="elmah"> <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah"/> <section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah"/> <section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah"/> </sectionGroup> </configSections> <appSettings/> <connectionStrings> <add name="elmah-sql" connectionString="Data Source=***;Initial Catalog=***;Persist Security Info=True;User ID=***;Password=***" /> </connectionStrings> <elmah> <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="elmah-sql" > </errorLog> <errorMail from="test@test.com" to="test@test.com" subject="Application Exception" async="false" smtpPort="25" smtpServer="***" userName="***" password="***"> </errorMail> </elmah> <system.web> <customErrors mode="RemoteOnly" defaultRedirect="CustomError.aspx"> <error statusCode="403" redirect="NotAuthorized.aspx" /> <!--<error statusCode="404" redirect="FileNotFound.htm" />--> </customErrors> <httpHandlers> <remove verb="*" path="*.asmx"/> <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/> <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" /> </httpHandlers> <httpModules> <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/> </httpModules> </system.web> </configuration> 
+82
Aug 29 '08 at 14:56
source share
3 answers

You need the HTTPModule ErrorMail.

add this line inside the <httpModules> section

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

If you use a remote SMTP server (which is similar to you), you do not need SMTP on the server.

+78
Aug 29 '08 at 15:04
source share

Yes, if you are not using a remote SMTP server, you must configure the SMTP server 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> 
+62
Aug 31 2018-11-11T00:
source share

I myself used Elmah in this configuration, and I had to configure the server with SMTP locally. This is a direct installation on the local IIS server. That should do the trick.

A good point above, you need the errorMail module, but if you are not using a remote SMTP server, you need SMTP locally, just for clarification.

+5
Aug 29 '08 at 15:04
source share



All Articles