TransferEncoding 枚举 
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
指定电子邮件附件的 Content-Transfer-Encoding 标头信息。
public enum class TransferEncodingpublic enum TransferEncodingtype TransferEncoding = Public Enum TransferEncoding- 继承
字段
| 名称 | 值 | 说明 | 
|---|---|---|
| Base64 | 1 | 将基于流的数据编码。 请参见 RFC 2406 第 6.8 节。 | 
| EightBit | 3 | 数据为可表示国际字符的 8 位字符,总行长不超过 1000 个字符。 更多关于 8 位 MIME 传送扩展的信息,请参见 IETF RFC 6152。 | 
| QuotedPrintable | 0 | 将由 US-ASCII 字符集中可打印的字符组成的数据编码。 请参阅 RFC 2406 第 6.7 节。 | 
| SevenBit | 2 | 用于不编码的数据。 数据为 7 位 US-ASCII 字符,总行长不超过 1000 个字符。 请参见 RFC2406 第 2.7 节。 | 
| Unknown | -1 | 表示传输编码未知。 | 
示例
以下代码示例显示 TransferEncoding 附件使用。
static void DisplayStreamAttachment( Attachment^ a )
{
   Stream^ s = a->ContentStream;
   StreamReader^ reader = gcnew StreamReader( s );
   Console::WriteLine( L"Content: {0}", reader->ReadToEnd() );
   Console::WriteLine( L"Content Type {0}", a->ContentType );
   Console::WriteLine( L"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 = nullptr;
}
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 要求传输数据采用 7 位 US-ASCII 字符,行数不超过 1000 个字符。
RFC 2045 第 6 节中详细介绍了内容传输编码值,请参阅 https://www.ietf.org。