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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Clean (reset) the mailer configuration.void
composeMail
(Mail email) Compose a full e-mail, ready to send.int
Get 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.MimeMessage
Get the MimeMessage ready for sending.jakarta.mail.Session
Get the configured session to connect the SMTP server.long
Get the configured wait time in milliseconds until the next mail bulk can be send.boolean
Load the e-mail configuration from the database.boolean
loadConfigurationFromProperties
(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:MailClient
Get the full active configuration of the mail client for debugging.- Specified by:
getDebugActiveConfiguration
in interfaceMailClient
- Returns:
- configuration as Map
-
clearConfiguration
public void clearConfiguration()Description copied from interface:MailClient
Clean (reset) the mailer configuration.- Specified by:
clearConfiguration
in interfaceMailClient
-
loadConfigurationFromProperties
Description copied from interface:MailClient
Load the e-mail configuration from a given property file.- Specified by:
loadConfigurationFromProperties
in interfaceMailClient
- Parameters:
resource
- as String return true on success- Returns:
- true on success
- Throws:
IOException
-
loadConfigurationFromDatabase
public boolean loadConfigurationFromDatabase()Description copied from interface:MailClient
Load the e-mail configuration from the database.- Specified by:
loadConfigurationFromDatabase
in interfaceMailClient
- Returns:
- true on success
-
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 interfaceMailClient
- 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 interfaceMailClient
- Returns:
- waitTime as long
-
composeMail
Description copied from interface:MailClient
Compose a full e-mail, ready to send.- Specified by:
composeMail
in interfaceMailClient
- Parameters:
email
- as Mail- Throws:
jakarta.mail.MessagingException
-
getSession
public jakarta.mail.Session getSession() throws jakarta.mail.NoSuchProviderExceptionDescription copied from interface:MailClient
Get the configured session to connect the SMTP server.- Specified by:
getSession
in interfaceMailClient
- Returns:
- session as Session
- Throws:
jakarta.mail.NoSuchProviderException
-
getMailObject
Description copied from interface:MailClient
Get the composing Mail Object.- Specified by:
getMailObject
in interfaceMailClient
- Returns:
- email as Mail
-
getMimeMessage
public jakarta.mail.internet.MimeMessage getMimeMessage()Description copied from interface:MailClient
Get the MimeMessage ready for sending.- Specified by:
getMimeMessage
in interfaceMailClient
- Returns:
- message as MimeMessage
-