C# Class Elmah.ErrorMailModule

HTTP module that sends an e-mail whenever an unhandled exception occurs in an ASP.NET web application.
Inheritance: HttpModuleBase, IExceptionFiltering
Show file Open project: elmah/Elmah Class Usage Examples

Protected Methods

Method Description
CreateErrorFormatter ( ) : ErrorTextFormatter

Creates the ErrorTextFormatter implementation to be used to format the body of the e-mail.

GetConfig ( ) : object

Gets the configuration object used by OnInit to read the settings for module.

OnDisposingMail ( ErrorMailEventArgs args ) : void

Fires the DisposingMail event.

OnError ( Exception e, System.Web.HttpContextBase context ) : void

Reports the exception.

OnError ( object sender, EventArgs e ) : void

The handler called when an unhandled exception bubbles up to the module.

OnErrorSignaled ( object sender, ErrorSignalEventArgs args ) : void

The handler called when an exception is explicitly signaled.

OnFiltering ( ExceptionFilterEventArgs args ) : void

Raises the Filtering event.

OnInit ( System.Web.HttpApplication application ) : void

Initializes the module and prepares it to handle requests.

OnMailed ( ErrorMailEventArgs args ) : void

Fires the Mailed event.

OnMailing ( ErrorMailEventArgs args ) : void

Fires the Mailing event.

ReportError ( Error error ) : void

Schedules the error to be e-mailed synchronously.

ReportErrorAsync ( Error error ) : void

Schedules the error to be e-mailed asynchronously.

The default implementation uses the ThreadPool to queue the reporting.

SendMail ( MailMessage mail ) : void

Sends the e-mail using SmtpMail or SmtpClient.

Private Methods

Method Description
CreateHtmlAttachment ( string name, string html ) : System.Net.Mail.Attachment
GetSetting ( System.Collections.IDictionary config, string name ) : string
GetSetting ( System.Collections.IDictionary config, string name, string defaultValue ) : string
ReportError ( object state ) : void

Method Details

CreateErrorFormatter() protected method

Creates the ErrorTextFormatter implementation to be used to format the body of the e-mail.
protected CreateErrorFormatter ( ) : ErrorTextFormatter
return ErrorTextFormatter

GetConfig() protected method

Gets the configuration object used by OnInit to read the settings for module.
protected GetConfig ( ) : object
return object

OnDisposingMail() protected method

Fires the DisposingMail event.
protected OnDisposingMail ( ErrorMailEventArgs args ) : void
args ErrorMailEventArgs
return void

OnError() protected method

Reports the exception.
protected OnError ( Exception e, System.Web.HttpContextBase context ) : void
e System.Exception
context System.Web.HttpContextBase
return void

OnError() protected method

The handler called when an unhandled exception bubbles up to the module.
protected OnError ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void

OnErrorSignaled() protected method

The handler called when an exception is explicitly signaled.
protected OnErrorSignaled ( object sender, ErrorSignalEventArgs args ) : void
sender object
args ErrorSignalEventArgs
return void

OnFiltering() protected method

Raises the Filtering event.
protected OnFiltering ( ExceptionFilterEventArgs args ) : void
args ExceptionFilterEventArgs
return void

OnInit() protected method

Initializes the module and prepares it to handle requests.
protected OnInit ( System.Web.HttpApplication application ) : void
application System.Web.HttpApplication
return void

OnMailed() protected method

Fires the Mailed event.
protected OnMailed ( ErrorMailEventArgs args ) : void
args ErrorMailEventArgs
return void

OnMailing() protected method

Fires the Mailing event.
protected OnMailing ( ErrorMailEventArgs args ) : void
args ErrorMailEventArgs
return void

ReportError() protected method

Schedules the error to be e-mailed synchronously.
protected ReportError ( Error error ) : void
error Error
return void

ReportErrorAsync() protected method

Schedules the error to be e-mailed asynchronously.
The default implementation uses the ThreadPool to queue the reporting.
protected ReportErrorAsync ( Error error ) : void
error Error
return void

SendMail() protected method

Sends the e-mail using SmtpMail or SmtpClient.
protected SendMail ( MailMessage mail ) : void
mail System.Net.Mail.MailMessage
return void