EmbeddedMailObjectsCollection クラスとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > EmbeddedMailObjectsCollection クラスの意味・解説 

EmbeddedMailObjectsCollection クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

並べ替えられた EmbeddedMailObject オブジェクト集合表します

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public NotInheritable Class
 EmbeddedMailObjectsCollection
    Inherits CollectionBase
Dim instance As EmbeddedMailObjectsCollection
public sealed class EmbeddedMailObjectsCollection
 : CollectionBase
public ref class EmbeddedMailObjectsCollection
 sealed : public CollectionBase
public final class EmbeddedMailObjectsCollection
 extends CollectionBase
public final class EmbeddedMailObjectsCollection
 extends CollectionBase
解説解説

EmbeddedMailObjectsCollection には、電子メール メッセージ埋め込まれる項目への参照格納されます。埋め込まれる項目には、企業ロゴなどのイメージ ファイル指定できますEmbeddedMailObjectsCollection は、MailDefinition オブジェクトの EmbeddedObjects プロパティによって使用されます。

埋め込みオブジェクト許可する電子メール メッセージは、その MailDefinition プロパティ宣言によって設定することにより、次の Web コントロール構成できます

  • CreateUserWizard

  • ChangePassword

  • PasswordRecovery

メモメモ

EmbeddedMailObject オブジェクトおよび EmbeddedMailObjectsCollection オブジェクトの値は、ビューステート保存されません。これにより、悪意あるユーザーサーバーパス情報調べることを防ぎます

使用例使用例

ChangePassword Web コントロール使用しSendingMail という名前の SendingMail イベントイベント ハンドラを含む ASP.NET ページ次のコード例示します。このコード例では、ASP.NET メンバシップフォーム認証使用するように構成されASP.NET Web サイトと、名前とパスワードわかっているユーザー作成されていることを前提にしています。詳細については、「方法 : 簡単なフォーム認証実装する」を参照してください

パスワード変更成功した場合SendingMail イベント ハンドラコードは、変更内容確認するための電子メール メッセージユーザー送信します。このコード例動作させるためには、あらかじめサーバー上で SMTP構成しておく必要がありますSMTP サーバー構成する方法については、「方法 : IIS 内で SMTP 仮想サーバーインストールおよび構成する」を参照してください。この例の目的では、必ずしも SMTP サーバー構成する要はありません。この例は、電子メール メッセージの送信エラーテストするために構築されています。

メール サーバー正しく構成されていない場合、または他のエラー発生して電子メール メッセージ送信できない場合SendMailError 関数呼び出されます。ユーザーメッセージ表示されます。さらに、MySamplesSite という名前のイベント ソースが既に存在するという前提で、Windowsアプリケーション イベント ログイベント記録されます。指定されイベント ソース作成するには、下記コード例参照してくださいイベント ソース作成詳細については、「ASP.NET Web ページサーバー イベント処理」を参照してくださいエラー処理されたことを示すために、SendMailErrorEventArgs オブジェクトHandled プロパティtrue設定されます。

<%@ Page Language="VB" AutoEventWireup="True"
 %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

  Public Sub MySendingMail(ByVal
 Sender As Object, ByVal
 e As MailMessageEventArgs)
    Message1.Text = "Sent mail to you to confirm the password
 change."
  End Sub

  Public Sub MySendMailError(ByVal
 Sender As Object, ByVal
 e As SendMailErrorEventArgs)
    Message1.Text = "Could not send mail to confirm the password
 change."
    
    ' The MySamplesSite event source has already been created by an
 administrator.
    Dim myLog As System.Diagnostics.EventLog
    myLog = new System.Diagnostics.EventLog
    myLog.Log = "Application"
    myLog.Source = "MySamplesSite"
    myLog.WriteEntry("Sending mail via SMTP failed with the following
 error: " & e.Exception.Message.ToString(), System.Diagnostics.EventLogEntryType.Error)

    e.Handled = True
    
  End Sub

</script>

<html  >
<head runat="server">
  <title>ChangePassword including a SendMailError Event</title>
</head>
<body>
  <form id="form1" runat="server">
  <div align="center">

    <h1>ChangePassword</h1>
    
    <asp:LoginView ID="LoginView1" Runat="server"
 
      Visible="true">
      <LoggedInTemplate>
        <asp:LoginName ID="LoginName1" Runat="server"
 FormatString="You are logged in as {0}." />
        <BR />
      </LoggedInTemplate>
      <AnonymousTemplate>
        You are not logged in
      </AnonymousTemplate>
    </asp:LoginView><br />
    
    <asp:ChangePassword ID="ChangePassword1" Runat="server"
      BorderStyle="Solid" 
      BorderWidth="1" 
      CancelDestinationPageUrl="~/Default.aspx" 
      DisplayUserName="true"
      OnSendingMail="MySendingMail" 
      OnSendMailError="MySendMailError" 
      ContinueDestinationPageUrl="~/Default.aspx"
 >
      <MailDefinition 
        BodyFileName="~\MailFiles\ChangePasswordMail.htm"
 
        Subject="Activity information for you">
        <EmbeddedObjects>
          <asp:EmbeddedMailObject Name="LoginGif"
 Path="~\MailFiles\Login.gif" />
          <asp:EmbeddedMailObject Name="PrivacyNoticeTxt"
 Path="~\MailFiles\PrivacyNotice.txt" />
        </EmbeddedObjects>
      </MailDefinition>
    </asp:ChangePassword><br />
  
    <asp:Label ID="Message1" Runat="server"
 ForeColor="Red" /><br />

    <asp:HyperLink ID="HyperLink1" Runat="server"
 
      NavigateUrl="~/Default.aspx">
      Home
    </asp:HyperLink>
    
  </div>
  </form>
</body>
</html>
<%@ Page Language="C#" AutoEventWireup="True" %>

<script runat="server">

  void MySendingMail(object sender, MailMessageEventArgs e)
  {
    Message1.Text = "Sent mail to you to confirm the password change.";
  }

  void MySendMailError(object sender, SendMailErrorEventArgs e)
  {
    Message1.Text = "Could not send email to confirm password change.";

    // The MySamplesSite event source has already been created by an
 administrator.
    System.Diagnostics.EventLog myLog = new System.Diagnostics.EventLog();
    myLog.Log = "Application";
    myLog.Source = "MySamplesSite";
    myLog.WriteEntry(
        "Sending mail via SMTP failed with the following error: " + 
        e.Exception.Message.ToString(), 
        System.Diagnostics.EventLogEntryType.Error);

    e.Handled = true;
  }

</script>

<html  >
<head runat="server">
  <title>ChangePassword including a SendMailError Event</title>
</head>
<body>
  <form id="form1" runat="server">
  <div align="center">

    <h1>ChangePassword</h1>
    
    <asp:LoginView ID="LoginView1" Runat="server" 
      Visible="true">
      <LoggedInTemplate>
        <asp:LoginName ID="LoginName1" Runat="server" FormatString="You
 are logged in as {0}." />
        <BR />
      </LoggedInTemplate>
      <AnonymousTemplate>
        You are not logged in
      </AnonymousTemplate>
    </asp:LoginView><br />
    
    <asp:ChangePassword ID="ChangePassword1" Runat="server"
      BorderStyle="Solid" 
      BorderWidth="1" 
      CancelDestinationPageUrl="~/Default.aspx" 
      DisplayUserName="true"
      OnSendingMail="MySendingMail" 
      OnSendMailError="MySendMailError" 
      ContinueDestinationPageUrl="~/Default.aspx" >
      <MailDefinition 
        BodyFileName="~\MailFiles\ChangePasswordMail.htm" 
        Subject="Activity information for you">
        <EmbeddedObjects>
          <asp:EmbeddedMailObject Name="LoginGif" Path="~\MailFiles\Login.gif"
 />
          <asp:EmbeddedMailObject Name="PrivacyNoticeTxt" Path="~\MailFiles\PrivacyNotice.txt"
 />
        </EmbeddedObjects>
      </MailDefinition>
    </asp:ChangePassword><br />
  
    <asp:Label ID="Message1" Runat="server" ForeColor="Red"
 /><br />

    <asp:HyperLink ID="HyperLink1" Runat="server" 
      NavigateUrl="~/Default.aspx">
      Home
    </asp:HyperLink>
    
  </div>
  </form>
</body>
</html>

MySamplesSite という名前のイベント ソースプログラムによってアプリケーション ログ追加する必要がある場合は、次のコード例使用します最初コード例正常に動作させるには、このイベント ソース存在する必要があります次のコード例には、管理者特権が必要です。

Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Diagnostics


Namespace CreateEventSource
  Class Program
    Sub Main()

        Try
            ' Create the source, if it does not already exist.
            If Not (EventLog.SourceExists("MySamplesSite"))
 Then
                EventLog.CreateEventSource("MySamplesSite",
 "Application")
                Console.WriteLine("Creating Event Source")
            End If

            ' Create an EventLog instance and assign its source.
            Dim myLog As New
 EventLog
            myLog.Source = "MySamplesSite"

            ' Write an informational entry to the event log.
            myLog.WriteEntry("Testing writing to event log.")

            Console.WriteLine("Message written to event log.")
        Catch e As Exception
            Console.WriteLine("Exception:")
            Console.WriteLine(e.ToString)
        End Try

    End Sub
  End Class
End Namespace
#region Using directives

using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;

#endregion

namespace CreateEventSource
{
    class Program
    {
        static void Main(string[]
 args)
        {

            try
            {
                // Create the source, if it does not already exist.
                if (!EventLog.SourceExists("MySamplesSite"))
                {
                    EventLog.CreateEventSource("MySamplesSite", "Application");
                    Console.WriteLine("Creating Event Source");
                }

                // Create an EventLog instance and assign its source.
                EventLog myLog = new EventLog();
                myLog.Source = "MySamplesSite";

                // Write an informational entry to the event log.  
  
                myLog.WriteEntry("Testing writing to event log.");

                Console.WriteLine("Message written to event log.");
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception:");
                Console.WriteLine("{0}", e.ToString());
            }
        }
    }
}

次のコード例は、前のコード例の ChangePasswordMail.htm ファイルとして使用できます

セキュリティに関するメモセキュリティに関するメモ

ユーザーアカウント名またはパスワード電子メール送信すると、セキュリティ脆弱になる可能性あります電子メール メッセージ一般に平文送信され特殊なネットワーク "スニッフィング" アプリケーション読み取られる可能性ありますセキュリティ強化するには、「ログイン コントロールセキュリティ保護」に記述されているリスク軽減策使用します

<html>
<head><title></title></head>
<body>
<form>

  <h1>Your password for the account named &quot;<%Username%>&quot;
 has changed.</h1>

  <p>
  If you did not initiate this change, please call 1-206-555-0100.
  </p>
  
  <p>
  <a href="http://www.contoso.com/login.aspx">
    <img src="https://weblio.hs.llnwd.net/e7/img/dict/msdnc/cid:LoginGif" alt="Log In" />
  </a> 
  </p>
  
  <p>
  Please read our attached Privacy Notice.
  </p>

</form>
</body>
</html>
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
   System.Collections.CollectionBase
    System.Web.UI.WebControls.EmbeddedMailObjectsCollection
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
EmbeddedMailObjectsCollection メンバ
System.Web.UI.WebControls 名前空間
CreateUserWizard クラス
CreateUserWizard.MailDefinition プロパティ
CreateUserWizard.SendingMail イベント
ChangePassword クラス
ChangePassword.MailDefinition プロパティ
ChangePassword.SendingMail イベント
PasswordRecovery
MailDefinition
SendingMail
EmbeddedMailObject クラス
MailMessage
その他の技術情報
Web サイト管理ツールの [アプリケーション] タブ



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「EmbeddedMailObjectsCollection クラス」の関連用語

EmbeddedMailObjectsCollection クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



EmbeddedMailObjectsCollection クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS