Interface AQMailMessage


  • public interface AQMailMessage
    This interface defines an email message which can be delivered to recipients via either AQSmtpServer or AQMailQueue.

    An instance of the object that implements the AQMailMessage interface can be instantiated via aqua.mail.newMessage() alias.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addBCCRecipient​(java.lang.String address)
      Add a valid email address, or a list of comma separated email addresses, to the list of blind carbon copy (BCC:) recipients.
      void addByteArrayAttachment​(byte[] bytes, java.lang.String attachmentName)
      Adds a byte array as an attachment.
      void addCCRecipient​(java.lang.String address)
      Add a valid email address, or a list of comma separated email addresses, to the list of carbon copy (CC:) recipients.
      void addFileAttachment​(java.io.File filename)
      Add a file on the local file system as an attachment.
      void addFileAttachment​(java.lang.String filename)
      Add a file on the local file system as an attachment.
      void addFileAttachment​(java.lang.String filename, java.lang.String attachmentName)
      Add a file on the local file system as an attachment with attachment name specified.
      void addHadoopFileAttachment​(AQHadoopDistributedFileSystem system, java.lang.String filename, java.lang.String attachmentName)
      Add a file on a Hadoop file system as an attachment.
      void addProjectFileAttachment​(AQProjectFile file)
      Adds a AQProjectFile as an attachment.
      void addProjectFileAttachment​(AQProjectFile file, java.lang.String attachmentName)
      Adds a AQProjectFile as an attachment.
      void addReplyTo​(java.lang.String replyTo)
      Add a valid email address, or a list of comma separated email addresses, to the list of addresses to which replies should be directed.
      void addToRecipient​(java.lang.String recipient)
      Add a valid email address, or a list of comma separated email addresses, to the list of recipients.
      java.lang.String[] getBCCRecipients()
      Returns a list of BCC: recipients, an empty array is returned if recipients are not defined.
      java.lang.String[] getCCRecipients()
      Returns a list of CC: recipients, an empty array is returned if recipients are not defined.
      java.lang.String[] getFileAttachments()
      Returns the list of file attachments, an empty array is returned if this message contains no file attachments.
      java.lang.String getFrom()
      Returns message sender email address or null if the address is not defined.
      java.lang.String getHtmlText()
      Returns message HTML text content or null if the HTML content is not defined.
      java.lang.String[] getReplyTo()
      Returns the list of addresses to which replies should be directed, an empty array is returned if Reply-To addresses are not defined.
      java.lang.String getSubject()
      Returns message subject or null if the message subject is not defined.
      java.lang.String getText()
      Returns message plain text content or null if the plain text content is not defined.
      java.lang.String[] getToRecipients()
      Returns a list of recipients, an empty array is returned if recipients are not defined.
      void queue()
      Delivers this message to recipients using the default AQMailQueue.
      void send()
      Delivers this message to recipients using the default AQSmtpServer.
      void setFrom​(java.lang.String sender)
      Sets sender email address.
      void setHtmlText​(java.lang.String htmlText)
      Set message HTML content.
      void setSubject​(java.lang.String subject)
      Set message subject.
      void setText​(java.lang.String text)
      Set message plain text content.
    • Method Detail

      • setFrom

        void setFrom​(java.lang.String sender)
        Sets sender email address. Sender email address is required in order to get mail delivered.
        Parameters:
        sender - Sender email address.
      • getFrom

        java.lang.String getFrom()
        Returns message sender email address or null if the address is not defined.
        Returns:
        the from
      • addToRecipient

        void addToRecipient​(java.lang.String recipient)
        Add a valid email address, or a list of comma separated email addresses, to the list of recipients. At least one recipient needs to be defined in order to get mail delivered.
        Parameters:
        recipient - To: email address, or a list of comma separated email addresses.
      • getToRecipients

        java.lang.String[] getToRecipients()
        Returns a list of recipients, an empty array is returned if recipients are not defined.
        Returns:
        the recipients
      • addCCRecipient

        void addCCRecipient​(java.lang.String address)
        Add a valid email address, or a list of comma separated email addresses, to the list of carbon copy (CC:) recipients.
        Parameters:
        address - CC: email address, or a list of comma separated email addresses.
      • getCCRecipients

        java.lang.String[] getCCRecipients()
        Returns a list of CC: recipients, an empty array is returned if recipients are not defined.
        Returns:
        the CC recipients
      • addBCCRecipient

        void addBCCRecipient​(java.lang.String address)
        Add a valid email address, or a list of comma separated email addresses, to the list of blind carbon copy (BCC:) recipients.
        Parameters:
        address - BCC: email address, or a list of comma separated email addresses.
      • getBCCRecipients

        java.lang.String[] getBCCRecipients()
        Returns a list of BCC: recipients, an empty array is returned if recipients are not defined.
        Returns:
        the BCC recipients
      • addReplyTo

        void addReplyTo​(java.lang.String replyTo)
        Add a valid email address, or a list of comma separated email addresses, to the list of addresses to which replies should be directed.
        Parameters:
        replyTo - email address, or a list of comma separated email addresses.
      • getReplyTo

        java.lang.String[] getReplyTo()
        Returns the list of addresses to which replies should be directed, an empty array is returned if Reply-To addresses are not defined.
        Returns:
        the reply to
      • setSubject

        void setSubject​(java.lang.String subject)
        Set message subject. Subject cannot be null, empty string is fine.
        Parameters:
        subject - Message subject.
      • getSubject

        java.lang.String getSubject()
        Returns message subject or null if the message subject is not defined.
        Returns:
        the subject
      • setText

        void setText​(java.lang.String text)
        Set message plain text content.
        Parameters:
        text - Message plain text content, ignored if null.
      • getText

        java.lang.String getText()
        Returns message plain text content or null if the plain text content is not defined.
        Returns:
        the text
      • setHtmlText

        void setHtmlText​(java.lang.String htmlText)
        Set message HTML content.
        Parameters:
        htmlText - Message HTML content, ignored if null.
      • getHtmlText

        java.lang.String getHtmlText()
        Returns message HTML text content or null if the HTML content is not defined.
        Returns:
        the HTML text
      • addFileAttachment

        void addFileAttachment​(java.lang.String filename)
                        throws java.lang.Exception
        Add a file on the local file system as an attachment. The base name of the specified file name will be used as attachment name.
        Parameters:
        filename - the file name.
        Throws:
        java.lang.Exception - if the specified file does not exist or inaccessible
      • addFileAttachment

        void addFileAttachment​(java.io.File filename)
                        throws java.lang.Exception
        Add a file on the local file system as an attachment. The base name of the specified file will be used as attachment name.
        Parameters:
        filename - the file name.
        Throws:
        java.lang.Exception - if the specified file does not exist or inaccessible
      • addFileAttachment

        void addFileAttachment​(java.lang.String filename,
                               java.lang.String attachmentName)
                        throws java.lang.Exception
        Add a file on the local file system as an attachment with attachment name specified.
        Parameters:
        filename - the file name.
        attachmentName - the name to be used to name the attachment
        Throws:
        java.lang.Exception - if the specified file does not exist or inaccessible
      • addByteArrayAttachment

        void addByteArrayAttachment​(byte[] bytes,
                                    java.lang.String attachmentName)
        Adds a byte array as an attachment.
        Parameters:
        bytes - the byte array
        attachmentName - the name to be used to name the attachment
      • addProjectFileAttachment

        void addProjectFileAttachment​(AQProjectFile file)
        Adds a AQProjectFile as an attachment. The base name of the specified file will be used as attachment name.
        Parameters:
        file - the project file
      • addProjectFileAttachment

        void addProjectFileAttachment​(AQProjectFile file,
                                      java.lang.String attachmentName)
        Adds a AQProjectFile as an attachment.
        Parameters:
        file - the project file
        attachmentName - the name to be used to name the attachment
      • addHadoopFileAttachment

        void addHadoopFileAttachment​(AQHadoopDistributedFileSystem system,
                                     java.lang.String filename,
                                     java.lang.String attachmentName)
                              throws java.lang.Exception
        Add a file on a Hadoop file system as an attachment.
        Parameters:
        system - the Hadoop file system where file is located
        filename - the name of the file on the Hadoop file system
        attachmentName - the name to be used to name the attachment
        Throws:
        java.lang.Exception - if the specified file does not exist or inaccessible
      • send

        void send()
           throws java.lang.Exception
        Delivers this message to recipients using the default AQSmtpServer.
        Throws:
        java.lang.Exception - On error
      • queue

        void queue()
            throws java.lang.Exception
        Delivers this message to recipients using the default AQMailQueue.
        Throws:
        java.lang.Exception - On error