Class SmtpAccount

java.lang.Object
com.axelor.mail.SmtpAccount
All Implemented Interfaces:
MailAccount

public class SmtpAccount extends Object implements MailAccount
The default implementation of MailAccount for SMPT accounts.
  • Constructor Details

    • SmtpAccount

      public SmtpAccount(String host, String port)
      Create a non-authenticating SMTP account.
      Parameters:
      host - the smtp server host
      port - the smtp server port
    • SmtpAccount

      public SmtpAccount(String host, String port, String user, String password)
      Create an authenticating SMTP account.
      Parameters:
      host - the smtp server host
      port - the smtp server port
      user - the smtp server login user name
      password - the smtp server login password
    • SmtpAccount

      public SmtpAccount(String host, String port, String user, String password, String channel)
      Create an authenticating SMTP account.
      Parameters:
      host - the smtp server host
      port - the smtp server port
      user - the smtp server login user name
      password - the smtp server login password
      channel - the smtp encryption channel (starttls or ssl)
    • SmtpAccount

      public SmtpAccount(String host, String port, String user, String password, String channel, String from)
      Create an authenticating SMTP account.
      Parameters:
      host - the smtp server host
      port - the smtp server port
      user - the smtp server login user name
      password - the smtp server login password
      channel - the smtp encryption channel (starttls or ssl)
      from - the envelope return address
  • Method Details

    • setConnectionTimeout

      public void setConnectionTimeout(int connectionTimeout)
      Description copied from interface: MailAccount
      Socket connection timeout value in milliseconds.
      Specified by:
      setConnectionTimeout in interface MailAccount
      Parameters:
      connectionTimeout - timeout value
    • setTimeout

      public void setTimeout(int timeout)
      Description copied from interface: MailAccount
      Socket read timeout value in milliseconds.
      Specified by:
      setTimeout in interface MailAccount
      Parameters:
      timeout - timeout value
    • setProperties

      public void setProperties(Properties properties)
      Description copied from interface: MailAccount
      Set additional properties.
      Specified by:
      setProperties in interface MailAccount
      Parameters:
      properties - the properties to set
    • getSession

      public jakarta.mail.Session getSession()
      Description copied from interface: MailAccount
      Get a Session for this account.

      The account implementation can decide whether to cache the session instance or not.
      Specified by:
      getSession in interface MailAccount
      Returns:
      a Session instance.