Interface IMailAttachment


  • @StableMinor(version="17.0",
                 sinceVersion="4.0")
    public interface IMailAttachment
    Stores information about a mail attachment.
    Since:
    4.0.4
    Version:
    $Revision$ $Date$
    • Method Detail

      • getContentType

        java.lang.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​(java.lang.String contentType)
        Sets the mime content type of this attachment.
        Parameters:
        contentType - the content type to set.
        Since:
        4.0.4
      • getName

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

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

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

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

        java.sql.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

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

        void setContent​(java.io.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

        java.io.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 java.lang.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
      • getContentId

        java.lang.String getContentId()
        Returns the content identifier used to construct the URI used refer to this attachment when it is inline.

        For a more simple way to embed the attachment in the HTML body, see embed().

        Returns:
        the content identifier.
        Since:
        14.0.0
        See Also:
        embed(), setContentDispositionType(ContentDispositionType)