Attachment.CreateAttachmentFromString Método
Definição
Cria um anexo com base em uma cadeia de caracteres.Creates an attachment from a string.
Sobrecargas
| CreateAttachmentFromString(String, ContentType) |
Cria um anexo de email usando o conteúdo da cadeia de caracteres especificada e o ContentType especificado.Creates a mail attachment using the content from the specified string, and the specified ContentType. |
| CreateAttachmentFromString(String, String) |
Cria um anexo de email usando o conteúdo da cadeia de caracteres especificada e o nome do tipo de conteúdo MIME especificado.Creates a mail attachment using the content from the specified string, and the specified MIME content type name. |
| CreateAttachmentFromString(String, String, Encoding, String) |
Cria um anexo de email usando o conteúdo da cadeia de caracteres especificada, o nome do tipo de conteúdo MIME especificado, a codificação de caracteres e as informações de cabeçalho MIME do anexo.Creates a mail attachment using the content from the specified string, the specified MIME content type name, character encoding, and MIME header information for the attachment. |
CreateAttachmentFromString(String, ContentType)
Cria um anexo de email usando o conteúdo da cadeia de caracteres especificada e o ContentType especificado.Creates a mail attachment using the content from the specified string, and the specified 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
Parâmetros
- content
- String
Um String que contém o conteúdo desse anexo.A String that contains the content for this attachment.
- contentType
- ContentType
Um objeto ContentType que representa o cabeçalho de Tipo de conteúdo de protocolo MIME (Multipurpose Internet Mail Exchange) a ser usado.A ContentType object that represents the Multipurpose Internet Mail Exchange (MIME) protocol Content-Type header to be used.
Retornos
Um objeto do tipo Attachment.An object of type Attachment.
Aplica-se a
CreateAttachmentFromString(String, String)
Cria um anexo de email usando o conteúdo da cadeia de caracteres especificada e o nome do tipo de conteúdo MIME especificado.Creates a mail attachment using the content from the specified string, and the specified MIME content type name.
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
Parâmetros
- content
- String
Um String que contém o conteúdo desse anexo.A String that contains the content for this attachment.
- name
- String
O valor de nome do tipo de conteúdo MIME no tipo de conteúdo associado a este anexo.The MIME content type name value in the content type associated with this attachment.
Retornos
Um objeto do tipo Attachment.An object of type Attachment.
Comentários
Se o conteúdo estiver em formato ASCII, a codificação de caracteres será definida como ASCII.If the content is in ASCII format then the character encoding is set to ASCII. Para todos os outros formatos, a codificação de caracteres é definida como UTF-8.For all other formats, the character encoding is set to utf-8. O tipo de mídia padrão é texto sem formatação.The default media type is plain text.
Se o conteúdo não estiver no formato ASCII e a codificação for nula, a codificação UTF-8 será usada.If the content is not in ASCII format and the encoding is null, utf-8 encoding is used.
Aplica-se a
CreateAttachmentFromString(String, String, Encoding, String)
Cria um anexo de email usando o conteúdo da cadeia de caracteres especificada, o nome do tipo de conteúdo MIME especificado, a codificação de caracteres e as informações de cabeçalho MIME do anexo.Creates a mail attachment using the content from the specified string, the specified MIME content type name, character encoding, and MIME header information for the attachment.
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
Parâmetros
- content
- String
Um String que contém o conteúdo desse anexo.A String that contains the content for this attachment.
- name
- String
O valor de nome do tipo de conteúdo MIME no tipo de conteúdo associado a este anexo.The MIME content type name value in the content type associated with this attachment.
- mediaType
- String
Um String que contém as informações de cabeçalho do conteúdo MIME deste anexo.A String that contains the MIME Content-Header information for this attachment. Este valor pode ser null.This value can be null.
Retornos
Um objeto do tipo Attachment.An object of type Attachment.