Package org.europa.together.business
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 Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidClean (reset) the mailer configuration.voidcomposeMail(Mail mail) 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.
-
Field Details
-
FEATURE_ID
Identifier for the given feature.- See Also:
-
CONFIG_SET
Define the configuration set for the MailClient.- See Also:
-
CONFIG_VERSION
Defines for which MODULE_VERSION the configuration will work.- See Also:
-
-
Method Details
-
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- case of error
-
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
Compose a full e-mail, ready to send.- Parameters:
mail- as Mail- Throws:
jakarta.mail.MessagingException- case of error
-
getSession
@API(status=STABLE, since="3.0") jakarta.mail.Session getSession() throws jakarta.mail.NoSuchProviderExceptionGet the configured session to connect the SMTP server.- Returns:
- session as Session
- Throws:
jakarta.mail.NoSuchProviderException- case of error
-
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
-