Class JavaSendMailer


  • public class JavaSendMailer
    extends JavaMailer2
    Use this class for sending e-mails.

    Crude extension of JavaMailer

    TODO: Improve class hierarchy

    TODO: Needs testing

    Author:
    David Hustace
    • Constructor Detail

      • JavaSendMailer

        public JavaSendMailer​(SendmailConfig config,
                              boolean useJmProps)
                       throws JavaMailerException
        Instantiates a new java send mailer.

        Constructs everything required to call send().

        Parameters:
        config - the sendmail configuration
        useJmProps - a boolean representing the handling of the deprecated javamail-configuration.properties file.
        Throws:
        JavaMailerException - the java mailer exception
      • JavaSendMailer

        public JavaSendMailer​(SendmailConfig config)
                       throws JavaMailerException
        Instantiates a new java send mailer.

        Using this constructor implies overriding sendmail configuration with properties from the deprecated javamail-configuration.properties file.

        Parameters:
        config - the sendmail configuration
        Throws:
        JavaMailerException - the java mailer exception
    • Method Detail

      • buildMimeMessage

        public javax.mail.internet.MimeMessage buildMimeMessage​(SendmailMessage msg)
        Builds the mime message.
        Parameters:
        msg - the sendmail message
        Returns:
        the mime message
      • createAuthenticator

        public javax.mail.Authenticator createAuthenticator()
        Creates the authenticator.
        Returns:
        the authenticator
      • send

        public void send​(javax.mail.internet.MimeMessage message)
                  throws JavaMailerException
        Send.
        Parameters:
        message - the message
        Throws:
        JavaMailerException - the java mailer exception
      • setConfig

        public void setConfig​(SendmailConfig config)
        Sets the sendmail configuration.
        Parameters:
        config - the new sendmail configuration
      • getConfig

        public SendmailConfig getConfig()
        Gets the sendmail configuration.
        Returns:
        the sendmail configuration
      • setMessage

        public void setMessage​(javax.mail.internet.MimeMessage message)
        Sets the message.
        Parameters:
        message - the new message
      • getMessage

        public javax.mail.internet.MimeMessage getMessage()
        Gets the message.
        Returns:
        the message
      • setProperties

        public void setProperties​(java.util.Properties properties)
        Sets the properties.
        Parameters:
        properties - the new properties
      • getProperties

        public java.util.Properties getProperties()
        Gets the properties.
        Returns:
        the properties