System.Web.UI.WebControls.ChangePassword.MailDefinition Property

Gets a reference to a collection of properties that define the e-mail message that is sent to users after they have changed their password.

Syntax

[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
[System.ComponentModel.NotifyParentProperty(true)]
[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)]
[System.Web.UI.Themeable(false)]
public MailDefinition MailDefinition { get; }

Value

Documentation for this section has not yet been entered.

Remarks

The ChangePassword.MailDefinition property returns a reference to a group of properties that you use to define the format and content of the e-mail message sent to users after they have changed their password. Common settings include the subject line and the sender's return address. For a complete list of properties, see System.Web.UI.WebControls.MailDefinition.

The ChangePassword.MailDefinition property is read-only; however, you can set the properties of the System.Web.UI.WebControls.MailDefinition object it returns. You can set these properties in the form property-subproperty, where subproperty represents a property of the System.Web.UI.WebControls.MailDefinition class (for example, MailDefinition-Subject). You can also set the properties programmatically in the form Property.Subproperty (for example,MailDefinition.Subject).

An e-mail message is sent only if the user has an e-mail address registered with the membership provider and if the MailDefinition.BodyFileName property of the ChangePassword.MailDefinition property points to a valid file. If the MailDefinition.BodyFileName property is set, the MailDefinition.From property must be set to an e-mail address; otherwise, an System.Web.HttpException exception is thrown.

If the e-mail message is created from the System.Web.UI.WebControls.MailDefinition object, it will make the substitutions shown in the following table. The substitution text is case-insensitive.

<% UserName %>

The Web site user name of the user.

<% Password %>

The new password for the user.

If the MailDefinition.IsBodyHtml property of the System.Web.UI.WebControls.MailDefinition object is true, the contents of the mail message will be HTML-encoded to guard against cross-site scripting security vulnerabilities for the message recipient.

You can use the ChangePassword.SendingMail event to modify the System.Net.Mail.MailMessage object that is created by the System.Web.UI.WebControls.MailDefinition object.

Note:

Sending user account names or passwords in e-mail is a potential security threat. E-mail messages are typically sent in plain text and can be read by special network "sniffing" applications. To improve security, use the mitigations that are described in Securing Login Controls.

This property cannot be set by themes or style sheet themes. For more information, see System.Web.UI.ThemeableAttribute and ASP.NET Themes Overview.

Requirements

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