Attachment.CreateAttachmentFromString 方法

定义

从字符串创建附件。

重载

名称 说明
CreateAttachmentFromString(String, ContentType)

使用指定字符串和指定 ContentType字符串中的内容创建邮件附件。

CreateAttachmentFromString(String, String)

使用指定字符串中的内容和指定的 MIME 内容类型名称创建邮件附件。

CreateAttachmentFromString(String, String, Encoding, String)

使用指定字符串中的内容、指定的 MIME 内容类型名称、字符编码和附件的 MIME 标头信息创建邮件附件。

CreateAttachmentFromString(String, ContentType)

Source:
Attachment.cs
Source:
Attachment.cs
Source:
Attachment.cs
Source:
Attachment.cs
Source:
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 对象,该对象表示要使用的多用途 Internet 邮件Exchange (MIME) 协议内容类型标头。

返回

一个 Attachment 类型的对象。

适用于

CreateAttachmentFromString(String, String)

Source:
Attachment.cs
Source:
Attachment.cs
Source:
Attachment.cs
Source:
Attachment.cs
Source:
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 格式且编码为 null,则使用 utf-8 编码。

适用于

CreateAttachmentFromString(String, String, Encoding, String)

Source:
Attachment.cs
Source:
Attachment.cs
Source:
Attachment.cs
Source:
Attachment.cs
Source:
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包含此附件的 MIME 内容标头信息。 此值可为 null

返回

一个 Attachment 类型的对象。

适用于