Attachment.CreateAttachmentFromString メソッド

定義

文字列から添付ファイルを作成します。

オーバーロード

CreateAttachmentFromString(String, ContentType)

指定した文字列のコンテンツと指定した ContentType を使用して、電子メールの添付ファイルを作成します。

CreateAttachmentFromString(String, String)

指定した文字列のコンテンツと指定した MIME コンテンツ タイプ名を使用して、電子メールの添付ファイルを作成します。

CreateAttachmentFromString(String, String, Encoding, String)

指定した文字列のコンテンツ、指定した MIME コンテンツ タイプ名、文字エンコーディング、添付ファイルの MIME ヘッダー情報を使用して、電子メールの添付ファイルを作成します。

CreateAttachmentFromString(String, ContentType)

ソース:
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

この添付ファイルのコンテンツを含む String

contentType
ContentType

使用する MIME (Multipurpose Internet Mail Exchange) プロトコルの Content-Type ヘッダーを表す ContentType オブジェクト。

戻り値

Attachment 型のオブジェクト。

適用対象

CreateAttachmentFromString(String, String)

ソース:
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

この添付ファイルのコンテンツを含む String

name
String

この添付ファイルに関連付けられているコンテンツ タイプの MIME コンテンツ タイプ名の値。

戻り値

Attachment 型のオブジェクト。

注釈

コンテンツが ASCII 形式の場合、文字エンコードは ASCII に設定されます。 その他のすべての形式では、文字エンコードは utf-8 に設定されます。 既定のメディアの種類はプレーン テキストです。

コンテンツが ASCII 形式ではなく、エンコードが null の場合は、utf-8 エンコードが使用されます。

適用対象

CreateAttachmentFromString(String, String, Encoding, String)

ソース:
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

この添付ファイルのコンテンツを含む String

name
String

この添付ファイルに関連付けられているコンテンツ タイプの MIME コンテンツ タイプ名の値。

contentEncoding
Encoding

Encoding。 この値は、null の場合もあります。

mediaType
String

この添付ファイルの MIME コンテンツ ヘッダー情報を含む String。 この値は、null の場合もあります。

戻り値

Attachment 型のオブジェクト。

適用対象