Class JavaMailClient

    • Constructor Detail

      • JavaMailClient

        public JavaMailClient()
        Constructor.
    • Method Detail

      • addAttachmentList

        public void addAttachmentList​(List<String> attachmentList)
        Description copied from interface: MailClient
        Add attachments from a given List of strings to the mail attachments. A list entry represents the full path to the attachment as String.
        Specified by:
        addAttachmentList in interface MailClient
        Parameters:
        attachmentList - as String
      • addRecipientList

        public void addRecipientList​(List<String> recipientList)
        Description copied from interface: MailClient
        Add a recipient from a given list of Strings to the mail recipients. A list entry represent a E-Mail Address as String. This function allows an import e-mail from other systems.
        Specified by:
        addRecipientList in interface MailClient
        Parameters:
        recipientList - as String
      • clearAttachments

        public void clearAttachments()
        Description copied from interface: MailClient
        Reset the Attachment List.
        Specified by:
        clearAttachments in interface MailClient
      • clearRecipents

        public void clearRecipents()
        Description copied from interface: MailClient
        Reset the Recipient List.
        Specified by:
        clearRecipents in interface MailClient
      • populateDbConfiguration

        public void populateDbConfiguration​(String sqlFile,
                                            boolean... connectTestDb)
        Description copied from interface: MailClient
        Population the database with the MailClient Configuration.
        Specified by:
        populateDbConfiguration in interface MailClient
        Parameters:
        sqlFile - as String
        connectTestDb - as boolean
      • setAttachmentSize

        public void setAttachmentSize​(long attachmentSize)
        Description copied from interface: MailClient
        Limit the maximum file size for attachments.
        Specified by:
        setAttachmentSize in interface MailClient
        Parameters:
        attachmentSize - as long
      • setContent

        public void setContent​(String content)
        Description copied from interface: MailClient
        Add E-MAil content from a String.
        Specified by:
        setContent in interface MailClient
        Parameters:
        content - as String
      • setMimeTypeToHTML

        public void setMimeTypeToHTML()
        Description copied from interface: MailClient
        Set the MimeType of a E-Mail to HTML.
        Specified by:
        setMimeTypeToHTML in interface MailClient
      • setMimeTypeToPlain

        public void setMimeTypeToPlain()
        Description copied from interface: MailClient
        Set the MimeType of an E-Mail to plain text.
        Specified by:
        setMimeTypeToPlain in interface MailClient
      • setSubject

        public void setSubject​(String subject)
        Description copied from interface: MailClient
        Add a subject (topic) to the mail.
        Specified by:
        setSubject in interface MailClient
        Parameters:
        subject - as String
      • addAttachment

        public boolean addAttachment​(String resource)
        Description copied from interface: MailClient
        Add an attachment to the Attachment List. The file size of attachments can be limited. To refer an attachment, set the resource e.g.: picture.png
        Specified by:
        addAttachment in interface MailClient
        Parameters:
        resource - as String
        Returns:
        true on success
      • addRecipent

        public boolean addRecipent​(String recipient)
        Description copied from interface: MailClient
        Add an Recipient to the Recipient List. The implementation check if the recipient already exist in the List. Also the format of an valid e-mail address will be tested. If an given E-Mail address is not valid it will not added to the List.
        Specified by:
        addRecipent in interface MailClient
        Parameters:
        recipient - as String
        Returns:
        true on success
      • clearConfiguration

        public void clearConfiguration()
        Description copied from interface: MailClient
        Clean (reset) the mailer configuration.
        Specified by:
        clearConfiguration in interface MailClient
      • getBulkMailLimiter

        public int getBulkMailLimiter()
        Description copied from interface: MailClient
        Get the limitation of the maximum amount of sending e-mails until a time interrupt will be processed.
        Specified by:
        getBulkMailLimiter in interface MailClient
        Returns:
        limitOfBulkMails as int
      • getWaitTime

        public long getWaitTime()
        Description copied from interface: MailClient
        Get the Configured wait time in milliseconds until the next mail bulk can be send.
        Specified by:
        getWaitTime in interface MailClient
        Returns:
        waitTime as long
      • getSession

        public javax.mail.Session getSession()
        Description copied from interface: MailClient
        Get the configured session to connect the SMTP Server.
        Specified by:
        getSession in interface MailClient
        Returns:
        session as Session
      • getAttachmentList

        public List<javax.activation.FileDataSource> getAttachmentList()
        Specified by:
        getAttachmentList in interface MailClient
        Returns:
        attachments as List
      • getRecipentList

        public List<javax.mail.internet.InternetAddress> getRecipentList()
        Specified by:
        getRecipentList in interface MailClient
        Returns:
        recipients as List
      • composeMail

        public javax.mail.internet.MimeMessage composeMail​(javax.mail.internet.InternetAddress recipient)
                                                    throws javax.mail.MessagingException
        Description copied from interface: MailClient
        Compose a full E-Mail, ready to send.
        Specified by:
        composeMail in interface MailClient
        Parameters:
        recipient - as InternetAddress
        Returns:
        e-mail as MimeMessage
        Throws:
        javax.mail.MessagingException - by error