Class SmtpClientImpl

java.lang.Object
org.codice.ddf.platform.email.impl.SmtpClientImpl
All Implemented Interfaces:
org.codice.ddf.platform.email.SmtpClient

public class SmtpClientImpl extends Object implements org.codice.ddf.platform.email.SmtpClient
Supports unauthenticated connections to a mail server and username/password authenticated connections over TLS. If the username is not blank and the password is not empty, then auth/tls will be used.

The method send(Message) will exceute asynchronously in a single thread. The number of operations awaiting execution is unbounded.

This code is experimental. While this interface is functional and tested, it may change or be removed in a future version of the library.

  • Constructor Details

    • SmtpClientImpl

      public SmtpClientImpl(ddf.security.encryption.EncryptionService encryptionService)
  • Method Details

    • setUserName

      public void setUserName(@Nullable String userName)
      Set the username for the email server.
      Parameters:
      userName - the username of the email server
    • setPassword

      public void setPassword(@Nullable String password)
      Set the password for the email server.
      Parameters:
      password - the password for the email server
    • setHostName

      public void setHostName(String hostName)
      Parameters:
      hostName - must be non-empty
    • setPortNumber

      public void setPortNumber(Integer portNumber)
      Parameters:
      portNumber - must be non-null and >0
    • setSecurityLogger

      public void setSecurityLogger(ddf.security.audit.SecurityLogger securityLogger)
    • createSession

      public javax.mail.Session createSession()
      Specified by:
      createSession in interface org.codice.ddf.platform.email.SmtpClient
    • send

      public Future<Void> send(javax.mail.Message message)
      Specified by:
      send in interface org.codice.ddf.platform.email.SmtpClient