Class JavaMailSendEmail

    • Constructor Detail

      • JavaMailSendEmail

        public JavaMailSendEmail()
    • Method Detail

      • requiresSmtpSessionInitialization

        public boolean requiresSmtpSessionInitialization()
        Returns whether the SMTP session needs to be initialized.
        Specified by:
        requiresSmtpSessionInitialization in class AbstractSendEmail
        Returns:
        true if the SMTP session needs to be initialized
      • initializeSmtpSession

        public void initializeSmtpSession​(String server,
                                          int port,
                                          boolean useTLS,
                                          boolean useSSL,
                                          int timeout,
                                          boolean requiresAuth,
                                          String user,
                                          BasePassword pw,
                                          String protocols)
                                   throws Exception
        Initializes the SMTP session.
        Specified by:
        initializeSmtpSession in class AbstractSendEmail
        Parameters:
        server - the SMTP server
        port - the SMTP port
        useTLS - whether to use TLS
        useSSL - whether to use SSL
        timeout - the timeout
        requiresAuth - whether authentication is required
        user - the SMTP user
        pw - the SMTP password
        protocols - the protocols to use, empty for default
        Throws:
        Exception - if initialization fails
      • newMessage

        protected javax.mail.internet.MimeMessage newMessage​(EmailAddress fromAddress,
                                                             EmailAddress[] toAddress,
                                                             EmailAddress[] ccAddress,
                                                             EmailAddress[] bccAddress,
                                                             String subject)
                                                      throws javax.mail.internet.AddressException,
                                                             javax.mail.MessagingException
        Creates a new email message.
        Parameters:
        fromAddress - the sender
        toAddress - the recipients, can be null
        ccAddress - the CC recipients, can be null
        bccAddress - the BCC recipients, can be null
        subject - the subject
        Returns:
        the email message
        Throws:
        javax.mail.internet.AddressException - in case of invalid internet addresses
        javax.mail.MessagingException - in case of a messaging problem
      • sendMail

        public boolean sendMail​(Email email)
                         throws Exception
        Sends an email.
        Specified by:
        sendMail in class AbstractSendEmail
        Parameters:
        email - the email to send
        Returns:
        true if successfully sent
        Throws:
        Exception - in case of invalid internet addresses or messaging problem