Class Mail


  • public class Mail
    extends Object
    Author:
    svenkubiak
    • Constructor Detail

      • Mail

        public Mail()
    • Method Detail

      • newMail

        public static Mail newMail()
        Creates a new mail instance
        Returns:
        A mail object instance
      • to

        public Mail to​(String... tos)
        Appends one or more TO address
        Parameters:
        tos - Address may be specified with personal name like this: Jenny Doe <email@foo.com>.
        Returns:
        A mail object instance
      • to

        public Mail to​(String to)
        Appends TO address
        Parameters:
        to - Address may be specified with personal name like this: Jenny Doe <email@foo.com>.
        Returns:
        A mail object instance
      • cc

        public Mail cc​(String... ccs)
        Sets one or more CC address
        Parameters:
        ccs - array of Strings to set.
        Returns:
        A mail object instance
      • cc

        public Mail cc​(String cc)
        Appends CC address
        Parameters:
        cc - Address may be specified with personal name like this: Jenny Doe <email@foo.com>.
        Returns:
        A mail object instance
      • bcc

        public Mail bcc​(String... bccs)
        Appends BCC address
        Parameters:
        bccs - array of Strings to set.
        Returns:
        A mail object instance
      • bcc

        public Mail bcc​(String bcc)
        Appends BCC address.
        Parameters:
        bcc - Address may be specified with personal name like this: Jenny Doe <email@foo.com>.
        Returns:
        A mail object instance
      • subject

        public Mail subject​(String subject)
        Sets message subject with specified encoding to override default platform encoding. The application must ensure that the subject does not contain any line breaks. See MimeMessage.setSubject(String, String).
        Parameters:
        subject - The message subject
        Returns:
        A mail object instance
      • from

        public Mail from​(String fromName,
                         String fromAddress)
        Sets the FROM address and name
        Parameters:
        fromName - The name of the sender e.g. Peter Parker
        fromAddress - Address may be specified with personal name like this: email@foo.com
        Returns:
        A mail object instance
      • header

        public Mail header​(String name,
                           String value)
        Sets header value.
        Parameters:
        name - The name of the header
        value - The value of the header
        Returns:
        A mail object instance
      • replyTo

        public Mail replyTo​(String replyTo)
        Appends REPLY-TO address
        Parameters:
        replyTo - Address may be specified with personal name like this: Jenny Doe <email@foo.com>
        Returns:
        A mail object instance
      • priority

        public Mail priority​(int priority)
        Sets the email priority
        Parameters:
        priority - - 1 being the highest priority, 3 = normal and 5 = lowest priority.
        Returns:
        A mail object instance
      • attachment

        public Mail attachment​(File file)
        Adds a file as attachment to the mail
        Parameters:
        file - The File to attach
        Returns:
        A mail object instance
      • textMessage

        public Mail textMessage​(String message)
        Adds plain message text
        Parameters:
        message - The text to add as a String.
        Returns:
        A mail object instance
      • htmlMessage

        public Mail htmlMessage​(String message)
        Adds html message text.
        Parameters:
        message - The text to add as a String.
        Returns:
        A mail object instance