SendMailErrorEventHandler Delegate
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents the method that handles the SendMailError
event of controls such as the ChangePassword control, the CreateUserWizard control, and the PasswordRecovery control.
public delegate void SendMailErrorEventHandler(System::Object ^ sender, SendMailErrorEventArgs ^ e);
public delegate void SendMailErrorEventHandler(object sender, SendMailErrorEventArgs e);
type SendMailErrorEventHandler = delegate of obj * SendMailErrorEventArgs -> unit
Public Delegate Sub SendMailErrorEventHandler(sender As Object, e As SendMailErrorEventArgs)
Parameters
- sender
- Object
The source of the event.
A SendMailErrorEventArgs object that contains the event data.
Remarks
When you create a 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 Forms Pages.
Handling the SendMailError
event allows your Web application to continue running, even if an exception occurs when trying to send an email 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 SendMailError event, or if you create an event handler but leave the Handled property set to false
, your Web application will stop running if an error occurs when sending an email message, and ASP.NET will display an error message.
The OnSendMailError method also allows derived classes to handle the event instead of the SendMailErrorEventHandler. This is the preferred technique for handling the event in a class that is derived from ChangePassword or CreateUserWizard.
For more information about handling events, see Server Event Handling in ASP.NET Web Forms Pages.
Extension Methods
GetMethodInfo(Delegate) |
Gets an object that represents the method represented by the specified delegate. |