TransferEncoding TransferEncoding TransferEncoding TransferEncoding Enum

定義

指定電子郵件訊息附件的內容傳遞編碼標頭資訊。Specifies the Content-Transfer-Encoding header information for an email message attachment.

public enum class TransferEncoding
public enum TransferEncoding
type TransferEncoding = 
Public Enum TransferEncoding
繼承
TransferEncodingTransferEncodingTransferEncodingTransferEncoding

欄位

Base64 Base64 Base64 Base64 1

對以資料流為基礎的資料進行編碼。Encodes stream-based data. 請參閱 RFC 2406 第 6.8 節。See RFC 2406 Section 6.8.

EightBit EightBit EightBit EightBit 3

這種資料為代表國際字元的 8 位元字元,且行的總長度不超過 1000 個 8 位元字元。The data is in 8-bit characters that may represent international characters with a total line length of no longer than 1000 8-bit characters. 如需這個 8 位元 MIME 傳輸擴充功能的詳細資訊,請參閱 IETF RFC 6152。For more information about this 8-bit MIME transport extension, see IETF RFC 6152.

QuotedPrintable QuotedPrintable QuotedPrintable QuotedPrintable 0

對資料進行編碼,而且該資料是由 US-ASCII 字元集內的可列印字元所組成。Encodes data that consists of printable characters in the US-ASCII character set. 請參閱 RFC 2406 第 6.7 節。See RFC 2406 Section 6.7.

SevenBit SevenBit SevenBit SevenBit 2

用於未編碼的資料。Used for data that is not encoded. 這種資料為 7 位元 US-ASCII 字元,且行的總長度不超過 1000 個字元。The data is in 7-bit US-ASCII characters with a total line length of no longer than 1000 characters. 請參閱 RFC 2406 第 2.7 節。See RFC2406 Section 2.7.

Unknown Unknown Unknown Unknown -1

指出傳輸編碼方式是未知的。Indicates that the transfer encoding is unknown.

範例

下列程式碼範例會TransferEncoding顯示附件所使用的。The following code example displays TransferEncoding used by an attachment.

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與屬性搭配使用。The values in the TransferEncoding enumeration are used with the AttachmentBase.TransferEncoding property.

內容傳輸-編碼標頭會指定相關訊息本文的編碼, 使其符合 SMTP 需求。The Content-Transfer-Encoding header specifies the encoding of the associated message body so that it meets SMTP requirements. SMTP 要求傳輸的資料必須是7位美國-ASCII 字元, 且行數不能超過1000個字元。SMTP requires data for transport to be in 7-bit US-ASCII characters with lines no longer than 1000 characters.

內容傳輸-編碼值會在 RFC 2045 第6節中詳細說明, 網址https://www.ietf.org為。Content-Transfer-Encoding values are described in detail in RFC 2045 Section 6, available at https://www.ietf.org.

適用於