Attachment.CreateAttachmentFromString Method (String, String, Encoding, String)


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.

Namespace:   System.Net.Mail
Assembly:  System (in System.dll)

public static Attachment CreateAttachmentFromString(
	string content,
	string name,
	Encoding contentEncoding,
	string mediaType


Type: System.String

A String that contains the content for this attachment.

Type: System.String

The MIME content type name value in the content type associated with this attachment.

Type: System.Text.Encoding

An Encoding. This value can be null.

Type: System.String

A String that contains the MIME Content-Header information for this attachment. This value can be null.

Return Value

Type: System.Net.Mail.Attachment

An object of type Attachment.

.NET Framework
Available since 2.0
Return to top