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 Details

  • 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 of DEFAULT_DEBUG_LOG_LOCATION as debug log location
      Parameters:
      fromAddress - not null
      toAddresses - not null, at least one
      mailServerHostname - not null
      mailServerPort - not null
    • 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 - not null
      toAddresses - not null, at least one
      toAddressesCc - may be null
      replyToAddresses - may be null
      useSmtps -
      mailServerHostname - not null
      mailServerPort - > 0
      mailServerUsername - may be null
      mailServerPassword - may be null
      trustStore - may be null
      keyStore - may be null
      keyStorePassword -
      signStore - may be null
      signStorePassword -
      mailOnErrorLogEvent - true if mail should be send for error log events
      mailOnErrorLogEventBufferSize - >= 0
      debugLogLocation - not null
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.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:
      send in interface MailService
    • getLog4jAppender

      public dev.dsf.bpe.mail.SmtpMailService.Log4jAppender getLog4jAppender()