GemBox.Email
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    Attachment Class

    Namespace:
    GemBox.Email
    Assembly:
    GemBox.Email.dll

    Represents a mail message attachment.

    • C#
    • VB.NET
    public sealed class Attachment
    Public NotInheritable Class Attachment
    Inheritance:
    Object
    Attachment

    Constructors

    Attachment(MediaType, Byte[])

    Initializes a new instance of the Attachment class with specified content type and content.

    • C#
    • VB.NET
    public Attachment(MediaType contentType, byte[] content)
    Public Sub New(contentType As MediaType, content As Byte())
    Parameters
    contentType
    MediaType

    The Content-Type header value.

    content
    Byte[]

    The content.

    Exceptions
    ArgumentNullException

    Content is null.

    Attachment(MediaType, Stream)

    Initializes a new instance of the Attachment class with specified content type and content.

    • C#
    • VB.NET
    public Attachment(MediaType contentType, Stream content)
    Public Sub New(contentType As MediaType, content As Stream)
    Parameters
    contentType
    MediaType

    The Content-Type header value.

    content
    Stream

    The content.

    Exceptions
    ArgumentException

    Content is null or empty.

    Attachment(MediaType, Stream, String)

    Initializes a new instance of the Attachment class with specified content type, content and file name.

    • C#
    • VB.NET
    public Attachment(MediaType contentType, Stream content, string fileName)
    Public Sub New(contentType As MediaType, content As Stream, fileName As String)
    Parameters
    contentType
    MediaType

    The Content-Type header value.

    content
    Stream

    The content.

    fileName
    String

    File name.

    Exceptions
    ArgumentException

    Content is null or empty.

    Attachment(Stream, String)

    Initializes a new instance of the Attachment class with specified content and file name.

    • C#
    • VB.NET
    public Attachment(Stream content, string fileName)
    Public Sub New(content As Stream, fileName As String)
    Parameters
    content
    Stream

    The content.

    fileName
    String

    File name.

    Exceptions
    ArgumentException

    Content is null or empty.

    Attachment(String)

    Initializes a new instance of the Attachment class from specified file.

    • C#
    • VB.NET
    public Attachment(string filePath)
    Public Sub New(filePath As String)
    Parameters
    filePath
    String

    A relative or absolute path for the file.

    Exceptions
    ArgumentException

    File path is null or empty.

    Properties

    ContentId

    Gets or sets the attachment content id.

    • C#
    • VB.NET
    public string ContentId { get; set; }
    Public Property ContentId As String
    Property Value
    String

    The attachment content id.

    Data

    Gets the attachment data stream.

    • C#
    • VB.NET
    public MemoryStream Data { get; }
    Public ReadOnly Property Data As MemoryStream
    Property Value
    MemoryStream

    The attachment data stream.

    DispositionType

    Gets the attachment content disposition type.

    • C#
    • VB.NET
    public ContentDispositionType DispositionType { get; }
    Public ReadOnly Property DispositionType As ContentDispositionType
    Property Value
    ContentDispositionType

    The attachment content disposition type.

    Exceptions
    ArgumentException

    Content disposition type cannot be set to Unknown.

    FileName

    Gets the file name.

    • C#
    • VB.NET
    public string FileName { get; }
    Public ReadOnly Property FileName As String
    Property Value
    String

    The file name, if defined; otherwise, null.

    MimeEntity

    Gets the underlying MIME entity.

    • C#
    • VB.NET
    public ContentEntity MimeEntity { get; }
    Public ReadOnly Property MimeEntity As ContentEntity
    Property Value
    ContentEntity

    The underlying MIME entity.

    Size

    Gets the data size.

    • C#
    • VB.NET
    public int? Size { get; }
    Public ReadOnly Property Size As Integer?
    Property Value
    Nullable<Int32>

    The data size, if defined; otherwise, null.

    Back to top

    Facebook • Twitter

    © GemBox Ltd. — All rights reserved.