CreateUserWizard.OnSendingMail メソッド
アセンブリ: System.Web (system.web.dll 内)

Dim e As MailMessageEventArgs Me.OnSendingMail(e)

新規ユーザーに送信される電子メール メッセージを変更するには、OnSendingMail メソッドを使用します。e パラメータとして渡された MailMessageEventArgs オブジェクトの Message プロパティには、新規ユーザーに送信される MailMessage オブジェクトが格納されます。MailMessage オブジェクトの各プロパティを変更して、電子メール メッセージを変更します。
電子メール メッセージが作成されるのは、MailDefinition プロパティで指定した MailDefinition オブジェクトの BodyFileName プロパティが有効なファイル名を指す場合だけです。
イベントが発生すると、デリゲートを使用してイベント ハンドラが呼び出されます。詳細については、「イベントの処理と発生」を参照してください。
OnSendingMail メソッドを使用すると、デリゲートを結び付けずに、派生クラスでイベントを処理することもできます。派生クラスでイベントを処理する場合は、この手法をお勧めします。
継承時の注意 派生クラスで OnSendingMail をオーバーライドする場合は、登録されているデリゲートがイベントを受け取ることができるように、基本クラスの OnSendingMail メソッドを必ず呼び出してください。
OnSendingMail メソッドを使用するカスタム CreateUserWizard コントロールを定義して、新規ユーザーに送信される電子メールのテキストを変更するコード例を次に示します。この例では、次のテキストを含む MailFile.txt という名前のテキスト ファイルが必要です。
Your account was set up on our Web site with the following: Username: <%UserName%> To reset your password, you must answer the following question: Password Question: <%PasswordQuestion%> Password Answer: <%PasswordAnswer%> Thank you for creating an account with our Web site.
<%@ Page Language="VB"%> <%@ Import namespace="Samples.AspNet.VB.Controls" %> <script runat="server"> Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Dim createUser As New CustomCreateUserWizard Placeholder1.Controls.Add(createUser) End Sub </script> <html> <head runat="server"> <title>CreateUserWizard.OnSendingMail sample</title> </head> <body> <form id="form1" runat="server"> <div> <asp:placeholder id="Placeholder1" runat="server" > </asp:placeholder> </div> </form> </body> </html>
<%@ Page Language="C#"%> <%@ Import namespace="Samples.AspNet.CS.Controls" %> <script runat="server"> private void Page_Load(object sender, EventArgs e) { Placeholder1.Controls.Add(new CustomCreateUserWizard()); } </script> <html> <head id="Head1" runat="server"> <title>CreateUserWizard.OnSendingMail sample</title> </head> <body> <form id="form1" runat="server"> <div> <asp:placeholder id="Placeholder1" runat="server" > </asp:placeholder> </div> </form> </body> </html>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からCreateUserWizard.OnSendingMail メソッドを検索する場合は、下記のリンクをクリックしてください。

- CreateUserWizard.OnSendingMail メソッドのページへのリンク