PasswordRecovery.MailDefinition 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得定義用於將新的或復原的密碼傳送給使用者之電子郵件訊息特性的屬性集合參考。
public:
property System::Web::UI::WebControls::MailDefinition ^ MailDefinition { System::Web::UI::WebControls::MailDefinition ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
[System.Web.UI.Themeable(false)]
public System.Web.UI.WebControls.MailDefinition MailDefinition { get; }
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
[<System.Web.UI.Themeable(false)>]
member this.MailDefinition : System.Web.UI.WebControls.MailDefinition
Public ReadOnly Property MailDefinition As MailDefinition
屬性值
的參考 MailDefinition ,其中包含定義用來傳送使用者密碼之電子郵件訊息特性的屬性。
- 屬性
範例
下列程式碼範例會 SendingMail 藉由設定 屬性的 MailDefinition 子屬性,使用 事件來定義密碼電子郵件訊息。
<%@ page language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
{
e.Message.IsBodyHtml = false;
e.Message.Subject = "New password on Web site.";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
<asp:passwordrecovery
id="PasswordRecovery1"
runat="server"
maildefinition-from="userAdmin@your.site.name.here"
onsendingmail="PasswordRecovery1_SendingMail">
</asp:passwordrecovery>
</form>
</body>
</html>
<%@ page language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Sub PasswordRecovery1_SendingMail(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MailMessageEventArgs)
e.Message.IsBodyHtml = False
e.Message.Subject = "New password on Web site."
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
<asp:passwordrecovery
id="PasswordRecovery1"
runat="server"
maildefinition-from="userAdmin@your.site.name.here"
onsendingmail="PasswordRecovery1_SendingMail">
</asp:passwordrecovery>
</form>
</body>
</html>
備註
屬性 MailDefinition 會傳回一組屬性的參考,您用來定義傳送給使用者之密碼電子郵件訊息的格式和內容。 常見的設定包括主旨行和寄件者的寄件者位址。 如需完整的屬性清單,請參閱 類別 MailDefinition 。
此屬性是唯讀的;不過,您可以設定它所傳回之 MailDefinition 物件的屬性。 您可以在 格式 Property-Subproperty
中宣告設定這些屬性,其中 Subproperty
代表類別的屬性 MailDefinition (例如, MailDefinition-Subject
) 。 您也可以以程式設計方式在表單 Property.Subproperty
中設定屬性,例如 () MailDefinition.Subject
。
這個屬性無法由佈景主題或樣式表主題設定。 如需詳細資訊,請參閱 ThemeableAttribute 和 ASP.NET 主題和外觀。
從 MailDefinition 物件建立電子郵件訊息時,它會進行下表所示的替代專案。 替代文字不區分大小寫。
替代文字 | 取代為 |
---|---|
<%UserName %> |
使用者的網站使用者名稱。 |
< %Password% > | 使用者已復原的密碼。 |
IsBodyHtml如果 物件的 屬性 MailDefinition 是 true
,郵件訊息的內容會編碼為 HTML,以防止郵件收件者的跨網站腳本安全性弱點。
適用於
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應