public class SMTPConnection
extends java.lang.Object
| Constructor and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
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)
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.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)
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.public java.lang.String getHost()
public void setHost(java.lang.String host)
host - The SMTP server address to use.public java.lang.String getPort()
public void setPort(java.lang.String port)
port - The SMTP server port to use (e.g. 25, 587, 465).public boolean isUseAuthentication()
public void setUseAuthentication(boolean useAuthentication)
useAuthentication - Determines whether authentication is needed for the SMTP server.public java.lang.String getSecure()
public void setSecure(java.lang.String secure)
secure - The encryption security layer to use for the SMTP connection ("TLS" or "SSL"). If
left blank, no encryption layer will be used.public java.lang.String getUsername()
public void setUsername(java.lang.String username)
username - The username to authenticate with.public java.lang.String getPassword()
public void setPassword(java.lang.String password)
password - The password to authenticate with.public java.lang.String getFrom()
public void setFrom(java.lang.String from)
from - The FROM field to use for dispatched e-mail messages.public int getSocketTimeout()
public void setSocketTimeout(int socketTimeout)
socketTimeout - The socket connection timeout value in milliseconds.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
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.org.apache.commons.mail.EmailExceptionpublic 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
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.org.apache.commons.mail.EmailExceptionpublic void send(java.lang.String toList,
java.lang.String ccList,
java.lang.String subject,
java.lang.String body)
throws org.apache.commons.mail.EmailException
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.org.apache.commons.mail.EmailException