Class BaseSmtpService

java.lang.Object
org.opencastproject.kernel.mail.BaseSmtpService
Direct Known Subclasses:
SmtpService

public class BaseSmtpService extends Object
Base implementation that allows to send e-mails using javax.mail.
  • Field Details

    • OPT_MAIL_PREFIX

      protected static final String OPT_MAIL_PREFIX
      Parameter prefix common to all "mail" properties
      See Also:
    • OPT_MAIL_TRANSPORT

      protected static final String OPT_MAIL_TRANSPORT
      Parameter name for the transport protocol
      See Also:
    • OPT_MAIL_HOST_SUFFIX

      protected static final String OPT_MAIL_HOST_SUFFIX
      Parameter suffix for the mail host
      See Also:
    • OPT_MAIL_PORT_SUFFIX

      protected static final String OPT_MAIL_PORT_SUFFIX
      Parameter suffix for the mail port
      See Also:
    • OPT_MAIL_TLS_ENABLE_SUFFIX

      protected static final String OPT_MAIL_TLS_ENABLE_SUFFIX
      Parameter suffix for the start tls status
      See Also:
    • OPT_MAIL_AUTH_SUFFIX

      protected static final String OPT_MAIL_AUTH_SUFFIX
      Parameter suffix for the authentication setting
      See Also:
    • OPT_MAIL_USER

      protected static final String OPT_MAIL_USER
      Parameter name for the username
      See Also:
    • OPT_MAIL_PASSWORD

      protected static final String OPT_MAIL_PASSWORD
      Parameter name for the password
      See Also:
    • OPT_MAIL_FROM

      protected static final String OPT_MAIL_FROM
      Parameter name for the recipient
      See Also:
    • OPT_MAIL_DEBUG

      protected static final String OPT_MAIL_DEBUG
      Parameter name for the debugging setting
      See Also:
    • mailTransport

      protected String mailTransport
      The current mail transport protocol
  • Constructor Details

    • BaseSmtpService

      public BaseSmtpService()
  • Method Details

    • setProductionMode

      public void setProductionMode(boolean mode)
    • isProductionMode

      public boolean isProductionMode()
    • setHost

      public void setHost(String host)
    • setMailTransport

      public void setMailTransport(String mailTransport)
    • setPort

      public void setPort(Integer port)
    • setUser

      public void setUser(String user)
    • setPassword

      public void setPassword(String password)
    • setDebug

      public void setDebug(boolean debug)
    • setSender

      public void setSender(String sender)
    • getSender

      public String getSender()
    • setSsl

      public void setSsl(boolean ssl)
    • configure

      public void configure()
    • getSession

      public javax.mail.Session getSession()
      Returns the default mail session that can be used to create a new message.
      Returns:
      the default mail session
    • createMessage

      public javax.mail.internet.MimeMessage createMessage()
      Creates a new message.
      Returns:
      the new message
    • send

      public void send(javax.mail.internet.MimeMessage message) throws javax.mail.MessagingException
      Sends message using the configured transport.
      Parameters:
      message - the message
      Throws:
      javax.mail.MessagingException - if sending the message failed