public class MailSenderImpl extends Object implements MailSender
MailSender
implementation.
The mail session is lazy initialized and reinitialized when properties
are changed.Constructor and Description |
---|
MailSenderImpl() |
Modifier and Type | Method and Description |
---|---|
String |
getHost()
Gets the smpt host name.
|
String |
getPassword()
Gets the SMTP user password.
|
int |
getPort()
Gets the smtp port.
|
javax.mail.Session |
getSession()
Gets an smtp session with the currently configured properties, creating
a new session if the session has not been initialized.
|
String |
getUser()
Returns the smtp user name.
|
boolean |
isAuthenticated()
Gets authentication state of underlying mail session.
|
boolean |
isTls()
Whether or not TLS is used to connect to the SMTP server.
|
void |
send(org.springframework.mail.SimpleMailMessage message)
Sends a mail message using an smtp session with properties matching
the current bean property values.
|
void |
send(org.springframework.mail.SimpleMailMessage[] messages)
Sends an array of mail message using an smtp session with properties
matching the current bean property values.
|
void |
setAuthenticated(boolean authenticated)
Sets authentication state of underlying mail session.
|
void |
setHost(String host)
Sets the smtp host name.
|
void |
setPassword(String password)
Sets the password and forces reinitialization of the authenticated
mail session if the session is authenticated.
|
void |
setPort(int port)
Sets the smpt port.
|
void |
setSession(javax.mail.Session session)
Sets the smtp session and modifies bean properties to match those of
the given session.
|
void |
setTls(boolean tls)
Gets TLS state of underlying mail session.
|
void |
setUser(String user)
Sets the smpt user name and forces reinitialization of the authenticated
mail session if the session is authenticated.
|
public boolean isTls()
MailSender
false
.isTls
in interface MailSender
public void setTls(boolean tls)
MailSender
setTls
in interface MailSender
tls
- new value for TLS transport propertypublic boolean isAuthenticated()
MailSender
false
.isAuthenticated
in interface MailSender
public void setAuthenticated(boolean authenticated)
MailSender
setAuthenticated
in interface MailSender
authenticated
- new value for session authentication propertypublic String getPassword()
MailSender
getPassword
in interface MailSender
public void setPassword(String password)
MailSender
setPassword
in interface MailSender
password
- new value for the passwordpublic String getUser()
MailSender
getUser
in interface MailSender
public void setUser(String user)
MailSender
setUser
in interface MailSender
user
- new value for the user namepublic javax.mail.Session getSession()
MailSender
getSession
in interface MailSender
public void setSession(javax.mail.Session session)
MailSender
setSession
in interface MailSender
session
- the new sessionpublic String getHost()
MailSender
localhost
.getHost
in interface MailSender
public void setHost(String host)
MailSender
setHost
in interface MailSender
host
- the new smtp host namepublic int getPort()
MailSender
25
.getPort
in interface MailSender
public void setPort(int port)
MailSender
setPort
in interface MailSender
port
- the new smtp portpublic void send(org.springframework.mail.SimpleMailMessage message) throws org.springframework.mail.MailException
MailSender
send
in interface MailSender
message
- message to sendorg.springframework.mail.MailException
- if a messsaging exception occurs sending
the messagepublic void send(org.springframework.mail.SimpleMailMessage[] messages) throws org.springframework.mail.MailException
MailSender
send
in interface MailSender
messages
- messages to sendorg.springframework.mail.MailException
- if a messsaging exception occursCopyright © 2003-2017 The Virtual Library Team. All Rights Reserved.