Interface MailClient

All Known Implementing Classes:
JakartaMailClient

@API(status=STABLE, since="1.0", consumers="JakartaMailClient") @Component public interface MailClient
Simple SMTP e-mail client with SSL to send E-Mails from a configured mail account (SMTP server). The mailer allows sending mass mails (e.g. newsletter), this feature needs a timer to interrupt after a configured amount of mails for a few seconds.
Since:
1.0
Version:
3.0
Author:
elmar.dott@gmail.com
  • Field Details

    • FEATURE_ID

      @API(status=STABLE, since="1.2") static final String FEATURE_ID
      Identifier for the given feature.
      See Also:
    • CONFIG_SET

      @API(status=STABLE, since="1.0") static final String CONFIG_SET
      Define the configuration set for the MailClient.
      See Also:
    • CONFIG_VERSION

      @API(status=STABLE, since="1.1") static final String CONFIG_VERSION
      Defines for which MODULE_VERSION the configuration will work.
      See Also:
  • Method Details

    • getDebugActiveConfiguration

      @API(status=STABLE, since="3.0") Map<String,String> getDebugActiveConfiguration()
      Get the full active configuration of the mail client for debugging.
      Returns:
      configuration as Map
    • clearConfiguration

      @API(status=STABLE, since="2.0") void clearConfiguration()
      Clean (reset) the mailer configuration.
    • loadConfigurationFromProperties

      @API(status=STABLE, since="3.0") boolean loadConfigurationFromProperties(String resource) throws IOException
      Load the e-mail configuration from a given property file.
      Parameters:
      resource - as String return true on success
      Returns:
      true on success
      Throws:
      IOException
    • loadConfigurationFromDatabase

      @API(status=STABLE, since="1.0") boolean loadConfigurationFromDatabase()
      Load the e-mail configuration from the database.
      Returns:
      true on success
    • getBulkMailLimiter

      @API(status=STABLE, since="1.0") int getBulkMailLimiter()
      Get the limitation of the maximum amount of sending e-mails until a time interrupt will be processed.
      Returns:
      limitOfBulkMails as int
    • getWaitTime

      @API(status=STABLE, since="1.0") long getWaitTime()
      Get the configured wait time in milliseconds until the next mail bulk can be send.
      Returns:
      waitTime as long
    • composeMail

      @API(status=STABLE, since="3.0") void composeMail(Mail mail) throws jakarta.mail.MessagingException
      Compose a full e-mail, ready to send.
      Parameters:
      mail - as Mail
      Throws:
      jakarta.mail.MessagingException
    • getSession

      @API(status=STABLE, since="3.0") jakarta.mail.Session getSession() throws jakarta.mail.NoSuchProviderException
      Get the configured session to connect the SMTP server.
      Returns:
      session as Session
      Throws:
      jakarta.mail.NoSuchProviderException
    • getMailObject

      @API(status=STABLE, since="3.0") Mail getMailObject()
      Get the composing Mail Object.
      Returns:
      email as Mail
    • getMimeMessage

      @API(status=STABLE, since="3.0") jakarta.mail.internet.MimeMessage getMimeMessage()
      Get the MimeMessage ready for sending.
      Returns:
      message as MimeMessage