com.mirth.connect.server.userutil
Class SMTPConnection

java.lang.Object
  extended by com.mirth.connect.server.userutil.SMTPConnection

public class SMTPConnection
extends java.lang.Object

Used to send e-mail messages.


Constructor Summary
SMTPConnection(java.lang.String host, java.lang.String port, boolean useAuthentication, java.lang.String secure, java.lang.String username, java.lang.String password, java.lang.String from)
          Instantiates an SMTP connection used to send e-mail messages with.
SMTPConnection(java.lang.String host, java.lang.String port, int socketTimeout, boolean useAuthentication, java.lang.String secure, java.lang.String username, java.lang.String password, java.lang.String from)
          Instantiates an SMTP connection used to send e-mail messages with.
 
Method Summary
 java.lang.String getFrom()
          Returns the FROM field being used for dispatched e-mail messages.
 java.lang.String getHost()
          Returns the SMTP server address.
 java.lang.String getPassword()
          Returns the password being used to authenticate to the SMTP server.
 java.lang.String getPort()
          Returns the SMTP server port.
 java.lang.String getSecure()
          Returns the encryption security layer being used for the SMTP connection (e.g "TLS" or "SSL").
 int getSocketTimeout()
          Returns the socket connection timeout value in milliseconds.
 java.lang.String getUsername()
          Returns the username being used to authenticate to the SMTP server.
 boolean isUseAuthentication()
          Returns true if authentication is needed for the SMTP server, otherwise returns false.
 void send(java.lang.String toList, java.lang.String ccList, java.lang.String subject, java.lang.String body)
          Sends an e-mail message.
 void send(java.lang.String toList, java.lang.String ccList, java.lang.String from, java.lang.String subject, java.lang.String body)
          Sends an e-mail message.
 void send(java.lang.String toList, java.lang.String ccList, java.lang.String from, java.lang.String subject, java.lang.String body, java.lang.String charset)
          Sends an e-mail message.
 void setFrom(java.lang.String from)
          Sets the FROM field to use for dispatched e-mail messages.
 void setHost(java.lang.String host)
          Sets the SMTP server address.
 void setPassword(java.lang.String password)
          Sets the password to use to authenticate to the SMTP server.
 void setPort(java.lang.String port)
          Sets the SMTP server port.
 void setSecure(java.lang.String secure)
          Sets the encryption security layer to use for the SMTP connection.
 void setSocketTimeout(int socketTimeout)
          Sets the socket connection timeout value.
 void setUseAuthentication(boolean useAuthentication)
          Sets whether authentication is needed for the SMTP server.
 void setUsername(java.lang.String username)
          Sets the username to use to authenticate to the SMTP server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SMTPConnection

public SMTPConnection(java.lang.String host,
                      java.lang.String port,
                      int socketTimeout,
                      boolean useAuthentication,
                      java.lang.String secure,
                      java.lang.String username,
                      java.lang.String password,
                      java.lang.String from)
Instantiates an SMTP connection used to send e-mail messages with.

Parameters:
host - The SMTP server address.
port - The SMTP server port (e.g. 25, 587, 465).
socketTimeout - The socket connection timeout value in milliseconds.
useAuthentication - Determines whether authentication is needed for the SMTP server.
secure - The encryption security layer to use for the SMTP connection ("TLS" or "SSL"). If left blank, no encryption layer will be used.
username - If authentication is required, the username to authenticate with.
password - If authentication is required, the password to authenticate with.
from - The FROM field to use for dispatched e-mail messages.

SMTPConnection

public SMTPConnection(java.lang.String host,
                      java.lang.String port,
                      boolean useAuthentication,
                      java.lang.String secure,
                      java.lang.String username,
                      java.lang.String password,
                      java.lang.String from)
Instantiates an SMTP connection used to send e-mail messages with.

Parameters:
host - The SMTP server address.
port - The SMTP server port (e.g. 25, 587, 465).
useAuthentication - Determines whether authentication is needed for the SMTP server.
secure - The encryption security layer to use for the SMTP connection ("TLS" or "SSL"). If left blank, no encryption layer will be used.
username - If authentication is required, the username to authenticate with.
password - If authentication is required, the password to authenticate with.
from - The FROM field to use for the e-mail.
Method Detail

getHost

public java.lang.String getHost()
Returns the SMTP server address.


setHost

public void setHost(java.lang.String host)
Sets the SMTP server address.

Parameters:
host - The SMTP server address to use.

getPort

public java.lang.String getPort()
Returns the SMTP server port.


setPort

public void setPort(java.lang.String port)
Sets the SMTP server port.

Parameters:
port - The SMTP server port to use (e.g. 25, 587, 465).

isUseAuthentication

public boolean isUseAuthentication()
Returns true if authentication is needed for the SMTP server, otherwise returns false.


setUseAuthentication

public void setUseAuthentication(boolean useAuthentication)
Sets whether authentication is needed for the SMTP server.

Parameters:
useAuthentication - Determines whether authentication is needed for the SMTP server.

getSecure

public java.lang.String getSecure()
Returns the encryption security layer being used for the SMTP connection (e.g "TLS" or "SSL").


setSecure

public void setSecure(java.lang.String secure)
Sets the encryption security layer to use for the SMTP connection.

Parameters:
secure - The encryption security layer to use for the SMTP connection ("TLS" or "SSL"). If left blank, no encryption layer will be used.

getUsername

public java.lang.String getUsername()
Returns the username being used to authenticate to the SMTP server.


setUsername

public void setUsername(java.lang.String username)
Sets the username to use to authenticate to the SMTP server.

Parameters:
username - The username to authenticate with.

getPassword

public java.lang.String getPassword()
Returns the password being used to authenticate to the SMTP server.


setPassword

public void setPassword(java.lang.String password)
Sets the password to use to authenticate to the SMTP server.

Parameters:
password - The password to authenticate with.

getFrom

public java.lang.String getFrom()
Returns the FROM field being used for dispatched e-mail messages.


setFrom

public void setFrom(java.lang.String from)
Sets the FROM field to use for dispatched e-mail messages.

Parameters:
from - The FROM field to use for dispatched e-mail messages.

getSocketTimeout

public int getSocketTimeout()
Returns the socket connection timeout value in milliseconds.


setSocketTimeout

public void setSocketTimeout(int socketTimeout)
Sets the socket connection timeout value.

Parameters:
socketTimeout - The socket connection timeout value in milliseconds.

send

public void send(java.lang.String toList,
                 java.lang.String ccList,
                 java.lang.String from,
                 java.lang.String subject,
                 java.lang.String body,
                 java.lang.String charset)
          throws org.apache.commons.mail.EmailException
Sends an e-mail message.

Parameters:
toList - A string representing a list of e-mail addresses to send the message to (separated by ",").
ccList - A string representing a list of e-mail addresses to copy the message to (separated by ",").
from - The FROM field to use for the e-mail message.
subject - The subject of the e-mail message.
body - The content of the e-mail message.
charset - The charset encoding to use when sending the e-mail message.
Throws:
org.apache.commons.mail.EmailException

send

public void send(java.lang.String toList,
                 java.lang.String ccList,
                 java.lang.String from,
                 java.lang.String subject,
                 java.lang.String body)
          throws org.apache.commons.mail.EmailException
Sends an e-mail message.

Parameters:
toList - A string representing a list of e-mail addresses to send the message to (separated by ",").
ccList - A string representing a list of e-mail addresses to copy the message to (separated by ",").
from - The FROM field to use for the e-mail message.
subject - The subject of the e-mail message.
body - The content of the e-mail message.
Throws:
org.apache.commons.mail.EmailException

send

public void send(java.lang.String toList,
                 java.lang.String ccList,
                 java.lang.String subject,
                 java.lang.String body)
          throws org.apache.commons.mail.EmailException
Sends an e-mail message.

Parameters:
toList - A string representing a list of e-mail addresses to send the message to (separated by ",").
ccList - A string representing a list of e-mail addresses to copy the message to (separated by ",").
subject - The subject of the e-mail message.
body - The content of the e-mail message.
Throws:
org.apache.commons.mail.EmailException