Package io.goobi.viewer.model.email
Class EMailSender
java.lang.Object
io.goobi.viewer.model.email.EMailSender
Sends plain-text and HTML e-mails via a configured SMTP server, supporting SSL, STARTTLS, and authenticated connections.
-
Constructor Summary
ConstructorsConstructorDescriptionEMailSender(Configuration config) EMailSender(String smtpServer, String smtpUser, String smtpPassword, String smtpSenderAddress, String smtpSenderName, String smtpSecurity, Integer smtpPort) -
Method Summary
-
Constructor Details
-
EMailSender
public EMailSender() -
EMailSender
- Parameters:
config- configuration object providing SMTP settings
-
EMailSender
public EMailSender(String smtpServer, String smtpUser, String smtpPassword, String smtpSenderAddress, String smtpSenderName, String smtpSecurity, Integer smtpPort) - Parameters:
smtpServer- hostname or IP address of the SMTP serversmtpUser- username for SMTP authenticationsmtpPassword- password for SMTP authenticationsmtpSenderAddress- email address used as the sendersmtpSenderName- display name shown as the sendersmtpSecurity- security protocol to use (NONE, SSL, STARTTLS)smtpPort- SMTP server port number
-
-
Method Details
-
postMail
public boolean postMail(List<String> recipients, List<String> cc, List<String> bcc, List<String> replyTo, String subject, String body) throws MessagingException, UnsupportedEncodingException Sends an email to with the given subject and body to the given recipient list using the given SMTP parameters.- Parameters:
recipients- list of primary recipient email addressescc- list of carbon-copy recipient email addressesbcc- list of blind carbon-copy recipient email addressesreplyTo- list of reply-to email addressessubject- email subject linebody- email body content- Returns:
- true if mail sent successfully; false otherwise
- Throws:
MessagingExceptionUnsupportedEncodingException
-