org.opencms.mail
Class CmsMailSettings

java.lang.Object
  extended by org.opencms.mail.CmsMailSettings

public class CmsMailSettings
extends java.lang.Object

Contains the settings for the OpenCms mail service.

Since:
6.0.0
Version:
$Revision: 1.16 $
Author:
Alexander Kandzior

Field Summary
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
CmsMailSettings()
          Empty constructor, required for configuration.
 
Method Summary
 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 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 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
 

Field Detail

MAIL_DEFAULT_PROTOCOL

public static final java.lang.String MAIL_DEFAULT_PROTOCOL
The default protocol for sending mail ("smtp").

See Also:
Constant Field Values

MAIL_DEFAULT_SENDER

public static final java.lang.String MAIL_DEFAULT_SENDER
The default mail from address.

See Also:
Constant Field Values
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 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")
username - the user name to use for authentication
password - the password to use for authentication

getDefaultMailHost

public CmsMailHost getDefaultMailHost()
Returns the default mail host.

Returns:
the default mail host

getMailFromDefault

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

Returns:
the mail from default sender

getMailHosts

public java.util.List getMailHosts()
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()