Package dev.dsf.bpe.mail
Class SmtpMailService
java.lang.Object
dev.dsf.bpe.mail.SmtpMailService
- All Implemented Interfaces:
MailService,org.springframework.beans.factory.InitializingBean
public class SmtpMailService
extends Object
implements MailService, org.springframework.beans.factory.InitializingBean
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSmtpMailService(String fromAddress, List<String> toAddresses, String mailServerHostname, int mailServerPort) SMTP, non authentication, mails not signed, no mails on error log events, value ofDEFAULT_DEBUG_LOG_LOCATIONas debug log locationSmtpMailService(String fromAddress, List<String> toAddresses, List<String> toAddressesCc, List<String> replyToAddresses, boolean useSmtps, String mailServerHostname, int mailServerPort, String mailServerUsername, char[] mailServerPassword, KeyStore trustStore, KeyStore keyStore, char[] keyStorePassword, KeyStore signStore, char[] signStorePassword, boolean mailOnErrorLogEvent, int mailOnErrorLogEventBufferSize, String debugLogLocation) -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateSslSocketFactory(KeyStore trustStore, KeyStore keyStore, char[] keyStorePassword) dev.dsf.bpe.mail.SmtpMailService.Log4jAppendervoidsend(String subject, javax.mail.internet.MimeBodyPart body, Consumer<javax.mail.internet.MimeMessage> messageModifier)
-
Field Details
-
DEFAULT_DEBUG_LOG_LOCATION
- See Also:
-
-
Constructor Details
-
SmtpMailService
public SmtpMailService(String fromAddress, List<String> toAddresses, String mailServerHostname, int mailServerPort) SMTP, non authentication, mails not signed, no mails on error log events, value ofDEFAULT_DEBUG_LOG_LOCATIONas debug log location- Parameters:
fromAddress- notnulltoAddresses- notnull, at least onemailServerHostname- notnullmailServerPort- notnull
-
SmtpMailService
public SmtpMailService(String fromAddress, List<String> toAddresses, List<String> toAddressesCc, List<String> replyToAddresses, boolean useSmtps, String mailServerHostname, int mailServerPort, String mailServerUsername, char[] mailServerPassword, KeyStore trustStore, KeyStore keyStore, char[] keyStorePassword, KeyStore signStore, char[] signStorePassword, boolean mailOnErrorLogEvent, int mailOnErrorLogEventBufferSize, String debugLogLocation) - Parameters:
fromAddress- notnulltoAddresses- notnull, at least onetoAddressesCc- may benullreplyToAddresses- may benulluseSmtps-mailServerHostname- notnullmailServerPort-> 0mailServerUsername- may benullmailServerPassword- may benulltrustStore- may benullkeyStore- may benullkeyStorePassword-signStore- may benullsignStorePassword-mailOnErrorLogEvent-trueif mail should be send for error log eventsmailOnErrorLogEventBufferSize->= 0debugLogLocation- notnull
-
-
Method Details
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
createSslSocketFactory
public SSLSocketFactory createSslSocketFactory(KeyStore trustStore, KeyStore keyStore, char[] keyStorePassword) -
send
public void send(String subject, javax.mail.internet.MimeBodyPart body, Consumer<javax.mail.internet.MimeMessage> messageModifier) - Specified by:
sendin interfaceMailService
-
getLog4jAppender
public dev.dsf.bpe.mail.SmtpMailService.Log4jAppender getLog4jAppender()
-