Class MailMessage


  • public class MailMessage
    extends Object
    The Class MailMessage.
    • Field Detail

      • attachments

        private final List<DataSource> attachments
        The attachments.
      • subject

        private String subject
        The subject.
      • body

        private String body
        The body.
      • bodyHtml

        private boolean bodyHtml
        The body html.
    • Constructor Detail

      • MailMessage

        public MailMessage​(String to,
                           String subject,
                           String body)
        Instantiates a new mail message.
        Parameters:
        to - the to
        subject - the subject
        body - the body
    • Method Detail

      • getToArray

        public String[] getToArray()
        Gets the to array.
        Returns:
        the to array
      • getCcArray

        public String[] getCcArray()
        Gets the cc array.
        Returns:
        the cc array
      • getBccArray

        public String[] getBccArray()
        Gets the bcc array.
        Returns:
        the bcc array
      • getAttachmentsArray

        public DataSource[] getAttachmentsArray()
        Gets the attachments array.
        Returns:
        the attachments array
      • getSubject

        public String getSubject()
        Gets the subject.
        Returns:
        the subject
      • getBody

        public String getBody()
        Gets the body.
        Returns:
        the body
      • isBodyHtml

        public boolean isBodyHtml()
        Checks if is body html.
        Returns:
        true, if is body html
      • addRecipientTo

        public MailMessage addRecipientTo​(String address)
        Adds the recipient to.
        Parameters:
        address - the address
        Returns:
        the mail message
      • addRecipientCc

        public MailMessage addRecipientCc​(String address)
        Adds the recipient cc.
        Parameters:
        address - the address
        Returns:
        the mail message
      • addRecipientBcc

        public MailMessage addRecipientBcc​(String address)
        Adds the recipient bcc.
        Parameters:
        address - the address
        Returns:
        the mail message
      • addAttachment

        public MailMessage addAttachment​(File attachment)
        Adds the attachment.
        Parameters:
        attachment - the attachment
        Returns:
        the mail message
      • addAttachment

        public MailMessage addAttachment​(DataSource attachment)
        Adds the attachment.
        Parameters:
        attachment - the attachment
        Returns:
        the mail message
      • clearRecipientsTo

        public MailMessage clearRecipientsTo()
        Clear recipients to.
        Returns:
        the mail message
      • clearRecipientsCc

        public MailMessage clearRecipientsCc()
        Clear recipients cc.
        Returns:
        the mail message
      • clearRecipientsBcc

        public MailMessage clearRecipientsBcc()
        Clear recipients bcc.
        Returns:
        the mail message
      • clearAttachments

        public MailMessage clearAttachments()
        Clear attachments.
        Returns:
        the mail message
      • setSubject

        public MailMessage setSubject​(String subject)
        Sets the subject.
        Parameters:
        subject - the subject
        Returns:
        the mail message
      • setBody

        public MailMessage setBody​(String body)
        Sets the body.
        Parameters:
        body - the body
        Returns:
        the mail message
      • setBodyHtml

        public MailMessage setBodyHtml​(boolean bodyHtml)
        Sets the body html.
        Parameters:
        bodyHtml - the body html
        Returns:
        the mail message
      • getTo

        protected List<String> getTo()
        Gets the to.
        Returns:
        the to
      • getCc

        protected List<String> getCc()
        Gets the cc.
        Returns:
        the cc
      • getBcc

        protected List<String> getBcc()
        Gets the bcc.
        Returns:
        the bcc
      • getAttachments

        protected List<DataSource> getAttachments()
        Gets the attachments.
        Returns:
        the attachments