Class SmtpEmailService

All Implemented Interfaces:
IEmailService, IServiceDefinitionAware
Direct Known Subclasses:
EmailService

public class SmtpEmailService extends AbstractEmailService
Provides an SMTP Email Service.
Since:
4.3.2
  • Field Details

  • Constructor Details

    • SmtpEmailService

      public SmtpEmailService()
  • Method Details

    • getConnectionTimeout

      public int getConnectionTimeout()
      Return the email server connection timeout.
      Returns:
      the email server connection timeout in milliseconds
      Since:
      23.10.0
    • setConnectionTimeout

      public void setConnectionTimeout(int connectionTimeout)
      Set the email server connection timeout.
      Parameters:
      connectionTimeout - the connection timeout value to be set
    • getEmailReadTimeout

      public int getEmailReadTimeout()
      Return the email server read timeout.
      Returns:
      the email server read timeout in milliseconds
      Since:
      23.10.0
    • setEmailReadTimeout

      public void setEmailReadTimeout(int emailReadTimeout)
      Set the email server read timeout.
      Parameters:
      emailReadTimeout - the read timeout value to be set
    • getEmailWriteTimeout

      public int getEmailWriteTimeout()
      Return the email server write timeout.
      Returns:
      the email server write timeout in milliseconds
      Since:
      23.10.0
    • setEmailWriteTimeout

      public void setEmailWriteTimeout(int emailWriteTimeout)
      Set the email server write timeout.
      Parameters:
      emailWriteTimeout - write timeout value to be set
    • getSenderEmailAddress

      public String getSenderEmailAddress()
      Return the email sender address.
      Returns:
      the email sender address
      Since:
      23.10.0
    • setSenderEmailAddress

      public void setSenderEmailAddress(String senderEmailAddress)
      Set the email sender address.
      Parameters:
      senderEmailAddress - the email sender address to be set
    • getSmtpPassword

      public String getSmtpPassword()
      Return the SMTP email server user password.
      Returns:
      email server user password
      Since:
      23.10.0
    • setSmtpPassword

      public void setSmtpPassword(String smtpPassword)
      Set the SMTP email server user password.
      Parameters:
      smtpPassword - the SMTP email server user password to be set
    • getSmtpServerHost

      public String getSmtpServerHost()
      Return the SMTP email server host name.
      Returns:
      the SMTP email server host name
      Since:
      23.10.0
    • setSmtpServerHost

      public void setSmtpServerHost(String smtpServerHost)
      Set the SMTP email server host name.
      Parameters:
      smtpServerHost - SMTP email server host name to be set
    • getSmtpServerPort

      public int getSmtpServerPort()
      Return the SMTP email server port number.
      Returns:
      the SMTP email server port number
      Since:
      23.10.0
    • setSmtpServerPort

      public void setSmtpServerPort(int smtpServerPort)
      Set the SMTP email server port number.
      Parameters:
      smtpServerPort - the SMTP email server port number to be set
    • getSmtpUser

      public String getSmtpUser()
      Return the SMTP email server username.
      Returns:
      the SMTP email server username
      Since:
      23.10.0
    • setSmtpUser

      public void setSmtpUser(String smtpUser)
      Set the SMTP email server username.
      Parameters:
      smtpUser - the SMTP email server username to be set
    • isSslCheckServerIdentity

      public Boolean isSslCheckServerIdentity()
      Return whether Checking is enabled for the server from the Socket connection against the server name(s) as expressed in the server certificate (RFC 2595 check) (mail.smtp.ssl.checkserveridentity).
      Returns:
      true if the check is enabled
      Since:
      23.10.0
    • setSslCheckServerIdentity

      public void setSslCheckServerIdentity(Boolean sslCheckServerIdentity)
      Determine whether Checking should be enabled for the server from the Socket connection against the server name(s) as expressed in the server certificate (RFC 2595 check) (mail.smtp.ssl.checkserveridentity).
      Parameters:
      sslCheckServerIdentity - whether to enable the check
    • isStartTlsConnection

      public Boolean isStartTlsConnection()
      Return whether to start TLS email server connection (mail.smtp.starttls.enable).
      Returns:
      true if the connection has started
      Since:
      23.10.0
    • setStartTlsConnection

      public void setStartTlsConnection(Boolean startTlsConnection)
      Determine whether to start TLS email server connection (mail.smtp.starttls.enable).
      Parameters:
      startTlsConnection - whether to start the connection
    • isUseGlobalSmtpSettings

      public Boolean isUseGlobalSmtpSettings()
      Return whether to use the global SMTP email settings.
      Returns:
      true if global SMTP email settings should be used
      Since:
      23.10.0
    • setUseGlobalSmtpSettings

      public void setUseGlobalSmtpSettings(Boolean useGlobalSmtpSettings)
      Determine whether to use the global SMTP email settings.
      Parameters:
      useGlobalSmtpSettings - whether to use the global SMTP email settings
    • sendEmailMessage

      public void sendEmailMessage(String subject, String message, String fromAddress, String replyToAddress, String toAddress, String ccAddress, String bccAddress, Map<String,byte[]> attachmentMap, Submission submission)
      Send an email message.
      Parameters:
      subject - email subject
      message - email message body
      fromAddress - the from address
      replyToAddress - the reply-to address
      toAddress - email to address
      ccAddress - email address to cc
      bccAddress - email address to bcc
      attachmentMap - attachments map
      submission - the submission the email relates to (optional)
    • queueEmail

      public EmailQueue queueEmail(Portal portal, String from, String to, String subject, String body, String category)
      Create an email on the email queue

      Note that this method contains database transactions.

      This method is provided for backwards compatibility.

      Parameters:
      portal - the portal object
      from - from address
      to - to address
      subject - the email subject
      body - the email body
      category - the category of the email queue
      Returns:
      the resulting email queue entry
    • queueEmail

      public EmailQueue queueEmail(Portal portal, String from, String to, String subject, String body, String category, Map<String,byte[]> attachmentMap)
      Create an email on the email queue

      Note that this method contains database transactions.

      This method is provided for backwards compatibility.

      Parameters:
      portal - the portal object
      from - from address
      to - to address
      subject - the email subject
      body - the email body
      category - the category of the email queue
      attachmentMap - the map of attachments (optional)
      Returns:
      the resulting email queue entry
      Since:
      4.1.0