Class Attachment


  • public class Attachment
    extends Object

    Attachment class.

    Version:
    $Id: $Id
    Author:
    mailersend
    • Field Detail

      • content

        @SerializedName("content")
        public String content
      • filename

        @SerializedName("filename")
        public String filename
      • id

        @SerializedName("id")
        public String id
      • disposition

        @SerializedName("disposition")
        public String disposition
    • Constructor Detail

      • Attachment

        public Attachment()
    • Method Detail

      • AddAttachmentFromFile

        public void AddAttachmentFromFile​(String path)
                                   throws IOException
        Reads a file, encodes it to base64 and sets it as an attachment
        Parameters:
        path - a String object.
        Throws:
        IOException
      • setAttachment

        public void setAttachment​(String content,
                                  String filename)
        Sets an attachments contents and filename
        Parameters:
        content - The base64 contents of the attachment
        filename - a String object.
      • AddImageFromFile

        public void AddImageFromFile​(String contentId,
                                     String path)
                              throws IOException
        Reads a file, encodes it to base64 and sets it as an attachment
        Parameters:
        contentId - The contentId of the image. If set and not empty, disposition will be set to inline, else to attachment
        path - a String object.
        Throws:
        IOException
      • setImage

        public void setImage​(String contentId,
                             String content,
                             String filename)
        Sets an attachments contents and filename
        Parameters:
        contentId - The contentId of the image. If set and not empty, disposition will be set to inline, else to attachment
        content - The base64 contents of the attachment
        filename - a String object.
      • setDisposition

        public void setDisposition​(boolean inline)
        Sets the disposition of this attachment.
        Parameters:
        inline - If set to true, disposition will be set to "inline", if false to "attachment"