英語で読む

次の方法で共有


TransferEncoding 列挙型

定義

電子メール メッセージの添付データの Content-Transfer-Encoding ヘッダー情報を指定します。

C#
public enum TransferEncoding
継承
TransferEncoding

フィールド

名前 説明
Base64 1

ストリーム ベースのデータをエンコードします。 RFC 2406 セクション 6.8 を参照してください。

EightBit 3

このデータは、行の全長が 8 ビット文字で 1000 以内の、国際文字を表す可能性がある 8 ビット文字です。 この 8 ビット MIME トランスポート拡張機能の詳細については、IETF RFC 6152 を参照してください。

QuotedPrintable 0

US-ASCII 文字セットの印刷可能な文字で構成されるデータをエンコードします。 RFC 2406 セクション 6.7 を参照してください。

SevenBit 2

エンコードされないデータに使用されます。 このデータは、行の全長が 1000 文字以内の 7 ビット US-ASCII 文字です。 RFC 2406 セクション 2.7 を参照してください。

Unknown -1

転送エンコーディングが不明であることを示します。

次のコード例では、 TransferEncoding 添付ファイルによって使用される が表示されます。

C#
public static void DisplayStreamAttachment(Attachment a)
{
    Stream s = a.ContentStream;
    StreamReader reader = new StreamReader(s);
    Console.WriteLine("Content: {0}", reader.ReadToEnd());
    Console.WriteLine("Content Type {0}", a.ContentType.ToString());
    Console.WriteLine("Transfer Encoding {0}", a.TransferEncoding);
    // Note that you cannot close the reader before the email is sent.
    // Closing the reader before sending the email will close the
    // ContentStream and cause an SmtpException.
    reader = null;
}

注釈

列挙体の TransferEncoding 値は、 プロパティと共に AttachmentBase.TransferEncoding 使用されます。

Content-Transfer-Encoding ヘッダーは、SMTP 要件を満たすように、関連付けられているメッセージ本文のエンコードを指定します。 SMTP では、トランスポート用のデータが 1000 文字以下の 7 ビット US-ASCII 文字に含まれる必要があります。

Content-Transfer-Encoding の値については、RFC 2045 セクション 6 https://www.ietf.org() で詳しく説明されています。

適用対象

製品 バージョン
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1