Interface IMailAttachment


  • @StableMinor(version="14.0",
                 sinceVersion="4.0")
    public interface IMailAttachment
    Stores information about a mail attachment.
    Since:
    4.0.4
    Version:
    $Revision: 24477 $ $Date: 2021-04-28 11:30:36 -0300 (Wed, 28 Apr 2021) $
    • Method Detail

      • getContentType

        String getContentType()
        Returns the mime content type of this attachment.
        Returns:
        the mime content type of this attachment.
        Since:
        4.0.4
      • setContentType

        void setContentType​(String contentType)
        Sets the mime content type of this attachment.
        Parameters:
        contentType - the content type to set.
        Since:
        4.0.4
      • getName

        String getName()
        Returns the name of this attachment.
        Returns:
        the name of this attachment.
        Since:
        4.0.4
      • setName

        void setName​(String name)
        Sets the name of this attachment.
        Parameters:
        name - the name value to set.
        Since:
        4.0.4
      • getDescription

        String getDescription()
        Returns the description of this attachment.
        Returns:
        the description of this attachment.
        Since:
        4.0.4
      • setDescription

        void setDescription​(String description)
        Sets the description of this attachment.
        Parameters:
        description - the description value to set.
        Since:
        4.0.4
      • getContent

        Blob getContent()
        Returns the content of this attachment. The blob returned is valid only during the transaction that generated it.
        Returns:
        the content of this attachment.
        Since:
        4.0.4
      • getId

        String getId()
        Returns a unique identifier for this attachment.
        Returns:
        a unique identifier for this attachment.
        Since:
        4.0.4
      • setContent

        void setContent​(InputStream inputStream,
                        int length)
        Sets the content for this mail attachment. The content will be read from the given input stream during the manager's send methods. So the input stream must stay opened until the send method is called.
        Parameters:
        inputStream - the content input stream.
        Since:
        4.0.4
      • getContentInputStream

        InputStream getContentInputStream()
        Gets the content input stream for this mail attachment.
        Parameters:
        inputStream - the content input stream.
        Since:
        4.0.4
      • getContentDispositionType

        IMailAttachment.ContentDispositionType getContentDispositionType()
        Returns the content disposition type set for this attachment.
        Returns:
        the content disposition type set for this attachment.
        Since:
        14.0.0
        See Also:
        IMailAttachment#setContentDisposition
      • embed

        default String embed()
        Sets the content disposition type for this attachment to IMailAttachment.ContentDispositionType.INLINE and returns the URI for referencing this attachment in its e-mail.

        Use example:

        IMailBody mailBody = mail.getBody(); IMailAttachment attachedImage = ManagerFactory.getSendMailManager().createMailAttachment(); attachedImage.setContent(imageInputStream, imageLength); attachedImage.setContentType("image/png"); String imageURI = attachedImage.embed(); mailBody.getAttachments().add(attachedImage); mailBody.setHtmlMsg("<img src=\"" + imageURI + "\"/>");
        Returns:
        the URI for referencing this attachment in its e-mail.
        Since:
        14.0.0