GrapeCity Secure Mail for .NET 4.0J
DeliveryStatusNotification クラス
メンバ  使用例 

SMTPを使用してメールを送信するときに使用する配信状況通知(DSN)オプションを指定します。
シンタックス
<TypeConverterAttribute("System.ComponentModel.ExpandableObjectConverter, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")>
Public Class DeliveryStatusNotification 
[TypeConverter("System.ComponentModel.ExpandableObjectConverter, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
public class DeliveryStatusNotification 
解説

オリジナルのSMTP仕様ではメッセージ送信の成功/失敗の通知に関するサポートはかなり制限されていたため、RFC 1891でSMTPプロトコルを拡張して配信状況通知(DSN)が定義されました。 DSNを使用すると、送信者が通知を受ける状況や通知自体の構成をより幅広く制御できます。これは、通知パラメーターを指定できるようにSMTP RCPTコマンドとMAILコマンドを拡張することによって実現されています。指定できるパラメーターは以下のとおりです。

これらのパラメーターの使用は、DeliveryStatusNotificationオブジェクトの以下のプロパティによって制御されます。

DeliveryStatusNotificationオブジェクトのプロパティが設定された後、DSNに関連するすべての通信は透過的に行われます。ORCPTパラメーターは自動的に追加され、受信者に設定されます。

使用例
以下のサンプルコードは、配信状況通知(DSN)を付けてメッセージを送信する方法を示します。
using System.Net.Mail;

private void sendWithDsn()
{
    // 使用するDSN IDを指定します。
    smtp1.DeliveryStatusNotification.EnvelopeID = "ID1234567";

    // ヘッダではなくメッセージ全体を返します。
    smtp1.DeliveryStatusNotification.ReturnMessage = true;

    // 配信が失敗したとき、または遅れたときにDSNを送信します。
    smtp1.DeliveryStatusNotification.Options = DeliveryNotificationOptions.Delay | DeliveryNotificationOptions.OnFailure;

    // メッセージを送信します。
    smtp1.Session.RemoteEndPoint = new IPEndPoint(myServer, Smtp.GetDefaultPort(smtp1.Session));
    smtp1.Session.Username = myUsername;
    smtp1.Session.Password = myPassword;
    smtp1.Send(toAddress, fromAddress, "Test", "Test Message.");
    // 適切にログアウトします。
    smtp1.Close();
}
Imports System.Net.Mail

Private Sub sendWithDsn()
    ' 使用するDSN IDを指定します。
    smtp1.DeliveryStatusNotification.EnvelopeID = "ID1234567"

    ' ヘッダではなくメッセージ全体を返します。
    smtp1.DeliveryStatusNotification.ReturnMessage = True

    ' 配信が失敗したとき、または遅れたときにDSNを送信します。
    smtp1.DeliveryStatusNotification.Options = DeliveryNotificationOptions.Delay Or DeliveryNotificationOptions.OnFailure

    ' メッセージを送信します。
    smtp1.Session.RemoteEndPoint = New IPEndPoint(myServer, Smtp.GetDefaultPort(smtp1.Session))
    smtp1.Session.Username = myUsername
    smtp1.Session.Password = myPassword
    smtp1.Send(toAddress, fromAddress, "Test", "Test Message.")
    ' 適切にログアウトします。
    smtp1.Close()
End Sub
継承階層

System.Object
   Dart.Mail.DeliveryStatusNotification

参照

参照

DeliveryStatusNotification メンバ
Dart.Mail 名前空間

 

 


© 2003, GrapeCity inc. All rights reserved.