Class SMTPConnection
java.lang.Object
com.mirth.connect.server.userutil.SMTPConnection
Used to send e-mail messages.
-
Constructor Summary
ConstructorsConstructorDescriptionSMTPConnection(String host, String port, boolean useAuthentication, String secure, String username, String password, String from) Instantiates an SMTP connection used to send e-mail messages with.SMTPConnection(String host, String port, int socketTimeout, boolean useAuthentication, String secure, String username, String password, String from) Instantiates an SMTP connection used to send e-mail messages with. -
Method Summary
Modifier and TypeMethodDescriptiongetFrom()Returns the FROM field being used for dispatched e-mail messages.getHost()Returns the SMTP server address.Returns the password being used to authenticate to the SMTP server.getPort()Returns the SMTP server port.Returns the encryption security layer being used for the SMTP connection (e.g "TLS" or "SSL").intReturns the socket connection timeout value in milliseconds.Returns the username being used to authenticate to the SMTP server.booleanReturns true if authentication is needed for the SMTP server, otherwise returns false.voidSends an e-mail message.voidSends an e-mail message.voidSends an e-mail message.voidSets the FROM field to use for dispatched e-mail messages.voidSets the SMTP server address.voidsetPassword(String password) Sets the password to use to authenticate to the SMTP server.voidSets the SMTP server port.voidSets the encryption security layer to use for the SMTP connection.voidsetSocketTimeout(int socketTimeout) Sets the socket connection timeout value.voidsetUseAuthentication(boolean useAuthentication) Sets whether authentication is needed for the SMTP server.voidsetUsername(String username) Sets the username to use to authenticate to the SMTP server.
-
Constructor Details
-
SMTPConnection
public SMTPConnection(String host, String port, int socketTimeout, boolean useAuthentication, String secure, String username, String password, 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(String host, String port, boolean useAuthentication, String secure, String username, String password, 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 Details
-
getHost
Returns the SMTP server address.- Returns:
- The SMTP server address.
-
setHost
Sets the SMTP server address.- Parameters:
host- The SMTP server address to use.
-
getPort
Returns the SMTP server port.- Returns:
- The SMTP server port.
-
setPort
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.- 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
Returns the encryption security layer being used for the SMTP connection (e.g "TLS" or "SSL").- Returns:
- The encryption security layer being used for the SMTP connection (e.g "TLS" or "SSL").
-
setSecure
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
Returns the username being used to authenticate to the SMTP server.- Returns:
- The username being used to authenticate to the SMTP server.
-
setUsername
Sets the username to use to authenticate to the SMTP server.- Parameters:
username- The username to authenticate with.
-
getPassword
Returns the password being used to authenticate to the SMTP server.- Returns:
- The password being used to authenticate to the SMTP server.
-
setPassword
Sets the password to use to authenticate to the SMTP server.- Parameters:
password- The password to authenticate with.
-
getFrom
Returns the FROM field being used for dispatched e-mail messages.- Returns:
- The FROM field being used for dispatched e-mail messages.
-
setFrom
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.- 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(String toList, String ccList, String from, String subject, String body, 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- If an error occurred while sending the e-mail message.
-
send
public void send(String toList, String ccList, String from, String subject, 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- If an error occurred while sending the e-mail message.
-
send
public void send(String toList, String ccList, String subject, 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- If an error occurred while sending the e-mail message.
-