Class CmsMailSettings


  • public class CmsMailSettings
    extends java.lang.Object
    Contains the settings for the OpenCms mail service.

    Since:
    6.0.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String MAIL_DEFAULT_PROTOCOL
      The default protocol for sending mail ("smtp").
      static java.lang.String MAIL_DEFAULT_SENDER
      The default mail from address.
    • Constructor Summary

      Constructors 
      Constructor Description
      CmsMailSettings()
      Empty constructor, required for configuration.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addMailHost​(java.lang.String hostname, java.lang.String order, java.lang.String protocol, java.lang.String username, java.lang.String password)
      Adds a new mail host to the internal list of mail hosts with default port 25.
      void addMailHost​(java.lang.String hostname, java.lang.String port, java.lang.String order, java.lang.String protocol, java.lang.String security, java.lang.String username, java.lang.String password)
      Adds a new mail host to the internal list of mail hosts.
      CmsMailHost getDefaultMailHost()
      Returns the default mail host.
      java.lang.String getMailFromDefault()
      Returns the mail from default sender.
      java.util.List<CmsMailHost> getMailHosts()
      Returns an unmodifiable sorted list of all configured mail hosts.
      void setMailFromDefault​(java.lang.String sender)
      Sets the mail from default sender.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • CmsMailSettings

        public CmsMailSettings()
        Empty constructor, required for configuration.

    • Method Detail

      • addMailHost

        public void addMailHost​(java.lang.String hostname,
                                java.lang.String order,
                                java.lang.String protocol,
                                java.lang.String username,
                                java.lang.String password)
        Adds a new mail host to the internal list of mail hosts with default port 25.

        Parameters:
        hostname - the name of the mail host
        order - the order in which the host is tried
        protocol - the protocol to use (default "smtp")
        username - the user name to use for authentication
        password - the password to use for authentication
      • addMailHost

        public void addMailHost​(java.lang.String hostname,
                                java.lang.String port,
                                java.lang.String order,
                                java.lang.String protocol,
                                java.lang.String security,
                                java.lang.String username,
                                java.lang.String password)
        Adds a new mail host to the internal list of mail hosts.

        Parameters:
        hostname - the name of the mail host
        port - the port of the mail host
        order - the order in which the host is tried
        protocol - the protocol to use (default "smtp")
        security - the security mode
        username - the user name to use for authentication
        password - the password to use for authentication
      • getMailFromDefault

        public java.lang.String getMailFromDefault()
        Returns the mail from default sender.

        Returns:
        the mail from default sender
      • getMailHosts

        public java.util.List<CmsMailHostgetMailHosts()
        Returns an unmodifiable sorted list of all configured mail hosts.

        Returns:
        an unmodifiable sorted list of all configured mail hosts
      • setMailFromDefault

        public void setMailFromDefault​(java.lang.String sender)
        Sets the mail from default sender.

        Parameters:
        sender - the mail from default sender to set
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        See Also:
        Object.toString()