Package org.europa.together.application
Class JakartaMailClient
java.lang.Object
org.europa.together.application.JakartaMailClient
- All Implemented Interfaces:
MailClient
Implementation of a simple SMTP Mailer.
-
Field Summary
Fields inherited from interface org.europa.together.business.MailClient
CONFIG_SET, CONFIG_VERSION, FEATURE_ID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClean (reset) the mailer configuration.voidcomposeMail(Mail email) Compose a full e-mail, ready to send.intGet the limitation of the maximum amount of sending e-mails until a time interrupt will be processed.Get the full active configuration of the mail client for debugging.Get the composing Mail Object.jakarta.mail.internet.MimeMessageGet the MimeMessage ready for sending.jakarta.mail.SessionGet the configured session to connect the SMTP server.longGet the configured wait time in milliseconds until the next mail bulk can be send.booleanLoad the e-mail configuration from the database.booleanloadConfigurationFromProperties(String resource) Load the e-mail configuration from a given property file.
-
Constructor Details
-
JakartaMailClient
public JakartaMailClient()Constructor.
-
-
Method Details
-
getDebugActiveConfiguration
Description copied from interface:MailClientGet the full active configuration of the mail client for debugging.- Specified by:
getDebugActiveConfigurationin interfaceMailClient- Returns:
- configuration as Map
-
clearConfiguration
public void clearConfiguration()Description copied from interface:MailClientClean (reset) the mailer configuration.- Specified by:
clearConfigurationin interfaceMailClient
-
loadConfigurationFromProperties
Description copied from interface:MailClientLoad the e-mail configuration from a given property file.- Specified by:
loadConfigurationFromPropertiesin interfaceMailClient- Parameters:
resource- as String return true on success- Returns:
- true on success
- Throws:
IOException- case of error
-
loadConfigurationFromDatabase
public boolean loadConfigurationFromDatabase()Description copied from interface:MailClientLoad the e-mail configuration from the database.- Specified by:
loadConfigurationFromDatabasein interfaceMailClient- Returns:
- true on success
-
getBulkMailLimiter
public int getBulkMailLimiter()Description copied from interface:MailClientGet the limitation of the maximum amount of sending e-mails until a time interrupt will be processed.- Specified by:
getBulkMailLimiterin interfaceMailClient- Returns:
- limitOfBulkMails as int
-
getWaitTime
public long getWaitTime()Description copied from interface:MailClientGet the configured wait time in milliseconds until the next mail bulk can be send.- Specified by:
getWaitTimein interfaceMailClient- Returns:
- waitTime as long
-
composeMail
Description copied from interface:MailClientCompose a full e-mail, ready to send.- Specified by:
composeMailin interfaceMailClient- Parameters:
email- as Mail- Throws:
jakarta.mail.MessagingException- case of error
-
getSession
public jakarta.mail.Session getSession() throws jakarta.mail.NoSuchProviderExceptionDescription copied from interface:MailClientGet the configured session to connect the SMTP server.- Specified by:
getSessionin interfaceMailClient- Returns:
- session as Session
- Throws:
jakarta.mail.NoSuchProviderException- case of error
-
getMailObject
Description copied from interface:MailClientGet the composing Mail Object.- Specified by:
getMailObjectin interfaceMailClient- Returns:
- email as Mail
-
getMimeMessage
public jakarta.mail.internet.MimeMessage getMimeMessage()Description copied from interface:MailClientGet the MimeMessage ready for sending.- Specified by:
getMimeMessagein interfaceMailClient- Returns:
- message as MimeMessage
-