public class SmtpClientImpl extends Object implements SmtpClient
The method send(Message)
will exceute asynchronously in a single thread. The number
of operations awaiting execution is unbounded.
This code is experimental. While this interface is functional and tested, it may change or be removed in a future version of the library.
Constructor and Description |
---|
SmtpClientImpl() |
Modifier and Type | Method and Description |
---|---|
javax.mail.Session |
createSession()
Create a session object that is pre-populated with the connection related parameters.
|
Future<Void> |
send(javax.mail.Message message)
Send the message.
|
void |
setHostName(String hostName) |
void |
setPassword(String password)
Set the password for the email server.
|
void |
setPortNumber(Integer portNumber) |
void |
setUserName(String userName)
Set the username for the email server.
|
public void setUserName(@Nullable String userName)
userName
- the username of the email serverpublic void setPassword(@Nullable String password)
password
- the password for the email serverpublic void setHostName(String hostName)
hostName
- must be non-emptypublic void setPortNumber(Integer portNumber)
portNumber
- must be non-null and >0public javax.mail.Session createSession()
SmtpClient
createSession
in interface SmtpClient
public Future<Void> send(javax.mail.Message message) throws javax.mail.MessagingException
SmtpClient
send
in interface SmtpClient
javax.mail.MessagingException
javax.mail.Transport.send(Message)
This work is licensed under a Creative Commons Attribution 4.0 International License.