System.Web.UI.WebControls.SendMailErrorEventArgs.Exception Property

Returns the exception thrown by an SMTP mail service when an e-mail message cannot be sent.

Syntax

public Exception Exception { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

The SendMailErrorEventArgs.Exception property contains the exception that is thrown by the SMTP mail provider when an e-mail message cannot be sent by the System.Web.UI.WebControls.ChangePassword control or the System.Web.UI.WebControls.CreateUserWizard. The most common reason for this exception is a configuration error in the smtp Element (Network Settings) of the machine configuration file, which produces the following exception message: The transport failed to connect to the server.

Exceptions are not thrown if there is an error in the e-mail message when embedding a file using MailDefinition.EmbeddedObjects. Instead, the embedded file appears broken when the mail message is viewed.

You must set the SendMailErrorEventArgs.Handled object, passed as the e parameter of System.Web.UI.WebControls.SendMailErrorEventArgs, to true to signal that the exception has been handled; otherwise, the exception is rethrown, and includes the original call stack and error message.

Requirements

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