public class Mailer extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Mailer.Message |
Constructor and Description |
---|
Mailer()
Create a mailer that can be configured using the API.
|
Mailer(Properties config)
Create a mailer that use the given properties to configure the session.
|
Mailer(String sessionName)
Create a mailer using a session that lookup for the session in JNDI
under the given session name.
|
Mailer(String sessionName,
Properties config)
Create a mailer using a session that lookup for the session in JNDI
under the given session name.
|
Modifier and Type | Method and Description |
---|---|
Properties |
getConfiguration() |
Session |
getSession() |
void |
loadConfiguration(InputStream in) |
Mailer.Message |
newMessage() |
void |
send(MimeMessage message) |
void |
sendEmail(String from,
String to,
String subject,
String body)
Send a single email.
|
void |
setAuthenticator(Authenticator auth) |
void |
setConfiguration(Properties config) |
void |
setCredentials(String user,
String pass)
Set SMTP credential
|
void |
setDebug(boolean debug) |
void |
setServer(String host) |
void |
setServer(String host,
boolean ssl) |
void |
setServer(String host,
String port)
Set the SMTP server address to use
|
void |
setServer(String host,
String port,
boolean ssl) |
public Mailer()
public Mailer(Properties config)
config
- public Mailer(String sessionName)
sessionName
- public Mailer(String sessionName, Properties config)
sessionName
- config
- public void setServer(String host)
public void setServer(String host, boolean ssl)
public void setServer(String host, String port)
host
- port
- public void setCredentials(String user, String pass)
user
- pass
- public void setAuthenticator(Authenticator auth)
public void setDebug(boolean debug)
public Session getSession()
public Properties getConfiguration()
public void setConfiguration(Properties config)
public void loadConfiguration(InputStream in) throws Exception
Exception
public void send(MimeMessage message) throws MessagingException
MessagingException
public Mailer.Message newMessage()
public void sendEmail(String from, String to, String subject, String body) throws MessagingException
MessagingException
Copyright © 2013 Nuxeo SA. All Rights Reserved.