Class MailSender


  • public final class MailSender
    extends Object
    The MailSender provides features to send mails.
    • Constructor Detail

      • MailSender

        public MailSender​(MailAccount account)
        Create a new MailSender with the given account.
        Parameters:
        account - the account to use
    • Method Detail

      • send

        public void send​(javax.mail.Message message)
                  throws javax.mail.MessagingException
        Send a mail message.
        Parameters:
        message - the message to sent
        Throws:
        javax.mail.MessagingException - if the message could not be sent
        See Also:
        Transport.send(Message)
      • send

        public void send​(String subject,
                         String text,
                         String... recipients)
                  throws javax.mail.MessagingException
        Send a simple text message to the given recipients.

        For better options, use compose() method to compose a message using MailBuilder which can be retrieved or sent directly with MailBuilder.build() or MailBuilder.send() methods.
        Parameters:
        subject - the message subject
        text - the message text
        recipients - list of recipients
        Throws:
        javax.mail.MessagingException - if the message could not be sent