語言

Attachment.CreateAttachmentFromString 方法

定義

用繩子建立連接。

多載

名稱 Description
CreateAttachmentFromString(String, ContentType)

利用指定字串的內容及指定的 ContentType。

CreateAttachmentFromString(String, String)

利用指定字串的內容及指定的 MIME 內容類型名稱建立郵件附件。

CreateAttachmentFromString(String, String, Encoding, String)

利用指定字串的內容、指定的 MIME 內容類型名稱、字元編碼及附件的 MIME 標頭資訊,建立郵件附件。

CreateAttachmentFromString(String, ContentType)

來源:
Attachment.cs
來源:
Attachment.cs
來源:
Attachment.cs
來源:
Attachment.cs
來源:
Attachment.cs

利用指定字串的內容及指定的 ContentType。

public:
 static System::Net::Mail::Attachment ^ CreateAttachmentFromString(System::String ^ content, System::Net::Mime::ContentType ^ contentType);
public static System.Net.Mail.Attachment CreateAttachmentFromString(string content, System.Net.Mime.ContentType contentType);
static member CreateAttachmentFromString : string * System.Net.Mime.ContentType -> System.Net.Mail.Attachment
Public Shared Function CreateAttachmentFromString (content As String, contentType As ContentType) As Attachment

參數

content
String

包含本附件內容的A String 。

contentType
ContentType

一個ContentType物件,代表多用途網際網路郵件Exchange(MIME)協定的內容型標頭,並用於使用。

傳回

Attachment 類型的物件。

適用於

CreateAttachmentFromString(String, String)

來源:
Attachment.cs
來源:
Attachment.cs
來源:
Attachment.cs
來源:
Attachment.cs
來源:
Attachment.cs

利用指定字串的內容及指定的 MIME 內容類型名稱建立郵件附件。

public:
 static System::Net::Mail::Attachment ^ CreateAttachmentFromString(System::String ^ content, System::String ^ name);
public static System.Net.Mail.Attachment CreateAttachmentFromString(string content, string? name);
public static System.Net.Mail.Attachment CreateAttachmentFromString(string content, string name);
static member CreateAttachmentFromString : string * string -> System.Net.Mail.Attachment
Public Shared Function CreateAttachmentFromString (content As String, name As String) As Attachment

參數

content
String

包含本附件內容的A String 。

name
String

與此附件相關的內容類型中的 MIME 內容類型名稱值。

傳回

Attachment 類型的物件。

備註

若內容為 ASCII 格式,則字元編碼會設定為 ASCII。 其他格式的字元編碼設定為 utf-8。 預設媒體類型是純文字。

若內容非 ASCII 格式且編碼為空,則使用 utf-8 編碼。

適用於

CreateAttachmentFromString(String, String, Encoding, String)

來源:
Attachment.cs
來源:
Attachment.cs
來源:
Attachment.cs
來源:
Attachment.cs
來源:
Attachment.cs

利用指定字串的內容、指定的 MIME 內容類型名稱、字元編碼及附件的 MIME 標頭資訊,建立郵件附件。

public:
 static System::Net::Mail::Attachment ^ CreateAttachmentFromString(System::String ^ content, System::String ^ name, System::Text::Encoding ^ contentEncoding, System::String ^ mediaType);
public static System.Net.Mail.Attachment CreateAttachmentFromString(string content, string? name, System.Text.Encoding? contentEncoding, string? mediaType);
public static System.Net.Mail.Attachment CreateAttachmentFromString(string content, string name, System.Text.Encoding contentEncoding, string mediaType);
static member CreateAttachmentFromString : string * string * System.Text.Encoding * string -> System.Net.Mail.Attachment
Public Shared Function CreateAttachmentFromString (content As String, name As String, contentEncoding As Encoding, mediaType As String) As Attachment

參數

content
String

包含本附件內容的A String 。

name
String

與此附件相關的內容類型中的 MIME 內容類型名稱值。

contentEncoding
Encoding

Encoding。 這個值可以是 null。

mediaType
String

String A 裡面包含此附件的 MIME 內容標頭資訊。 這個值可以是 null。

傳回

Attachment 類型的物件。

適用於