System.Web.UI.WebControls.ChangePassword.OnSendMailError Method

Raises the ChangePassword.SendMailError event when an e-mail message cannot be sent to the user.

Syntax

protected virtual void OnSendMailError (SendMailErrorEventArgs e)

Parameters

e
A System.Web.UI.WebControls.SendMailErrorEventArgs object containing the event data.

Remarks

The ChangePassword.OnSendMailError(SendMailErrorEventArgs) method is called when the SMTP mail system raises an exception while attempting to send an e-mail message after a user has changed a password.

Examine the SendMailErrorEventArgs.Exception property of the System.Web.UI.WebControls.SendMailErrorEventArgs object passed as the e parameter to determine the actual cause of the exception. The most common reason is a configuration error in the smtp section of the Web.config file.

You must set the SendMailErrorEventArgs.Handled property of the object passed as the e parameter to true to signal that the exception has been taken care of; otherwise, the exception is thrown again.

Raising an event invokes the event handler through a delegate. For more information, see Server Event Handling in ASP.NET Web Pages.

The ChangePassword.OnSendMailError(SendMailErrorEventArgs) method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

Requirements

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