Attachment

Attachment class

Inherits: Aspose::Email::AttachmentBase, Aspose::Email::IPreferredTextEncodingProvider

Represents an e-mail attachment.

The following example shows how to add and remove an Attachment from MailMessage .

// Create an instance of MailMessage class
var eml = new MailMessage {From = "sender@sender.com", To = "receiver@gmail.com"};
 
// Load an attachment
var attachment = new Attachment("1.txt");
eml.Attachments.Add(attachment);
 
// Remove attachment from your MailMessage
eml.Attachments.Remove(attachment);
' Create an instance of MailMessage class
Dim eml = New MailMessage With {
  .From = "sender@sender.com",
            .[To] = "receiver@gmail.com"
        }
 
' Load an attachment
Dim attachment = New Attachment("1.txt")
eml.Attachments.Add(attachment)
 
' Remove attachment from your MailMessage
eml.Attachments.Remove(attachment)

Constructors

NameDescription
Attachment (9 overloads)Initializes a new instance of the Attachment class.

Methods

NameDescription
Clone
ConvertToMapiAttachmentImplements Aspose::Email::AttachmentBase .
CreateAttachmentFromString (3 overloads)Creates the attachment from string.
CreateName
get_ContentDispositionGets Content-Disposition header
get_CreatedNameCreated name from subject in case when attacment is message/rfc822
get_IdObject identifier
get_IsEmbeddedMessageGets a value indicating whether the attachment is an embedded message.
get_IsTnefGets a value indicating whether the attachment is TNEF formatted message.
get_IsUriGets a value indicating whether attachment is URI-attachment.
get_NameGets an attachment name
get_NameEncodingGets an encoding of attachment name
get_PreferredTextEncodingGets a preferred text encoding
get_UniqueIdGets a unique identifier for the attachment that will be constant for each application run.
set_CreatedNameCreated name from subject in case when attacment is message/rfc822
set_NameSets an attachment name
set_NameEncodingSets an encoding of attachment name
set_PreferredTextEncodingSets a preferred text encoding
ToCalendarAttachmentProperty
CollectionNum
isUri