System.Web.UI.WebControls.SendMailErrorEventHandler Delegate

Represents the method that handles the SendMailError event of controls such as the System.Web.UI.WebControls.ChangePassword control, the System.Web.UI.WebControls.CreateUserWizard control, and the System.Web.UI.WebControls.PasswordRecovery control.

Syntax

public delegate void SendMailErrorEventHandler (object sender, SendMailErrorEventArgs e)

Parameters

sender
Documentation for this section has not yet been entered.
e
Documentation for this section has not yet been entered.

Remarks

When you create a System.Web.UI.WebControls.SendMailErrorEventHandler delegate, you identify the method that will handle the event. To associate the event with the event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate from the event. For more information about event-handler delegates, see Server Event Handling in ASP.NET Web Pages.

Handling the SendMailError event allows your Web application to continue running, even if an exception occurs when trying to send an e-mail message. For example, this is useful if the exception occurs when a user is working through a multi-step wizard. It is preferable to log the error, display an informative message to the user, and allow the user to complete the wizard rather than terminate the application.

If you do not create an event handler for the ChangePassword.SendMailError event, or if you create an event handler but leave the SendMailErrorEventArgs.Handled property set to false, your Web application will stop running if an error occurs when sending an e-mail message, and ASP.NET will display an error message.

The ChangePassword.OnSendMailError(SendMailErrorEventArgs) method also allows derived classes to handle the event instead of the System.Web.UI.WebControls.SendMailErrorEventHandler. This is the preferred technique for handling the event in a class that is derived from System.Web.UI.WebControls.ChangePassword or System.Web.UI.WebControls.CreateUserWizard.

For more information about handling events, see Server Event Handling in ASP.NET Web Pages.

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0