Class Mailer
- java.lang.Object
-
- org.nuxeo.ecm.automation.core.mail.Mailer
-
public class Mailer extends Object
- Author:
- Bogdan Stefanescu
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Mailer.Message
-
Field Summary
Fields Modifier and Type Field Description protected javax.mail.Authenticator
auth
Deprecated.since 11.1, not used anymoreprotected Properties
config
protected javax.mail.Session
session
protected String
sessionName
The JNDI session name.
-
Constructor Summary
Constructors Constructor Description Mailer()
Deprecated.since 11.1, use other constructors insteadMailer(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.Mailer(Properties config)
Create a mailer that use the given properties to configure the session.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Properties
getConfiguration()
javax.mail.Session
getSession()
void
loadConfiguration(InputStream in)
Mailer.Message
newMessage()
void
send(javax.mail.internet.MimeMessage message)
void
sendEmail(String from, String to, String subject, String body)
Send a single email.void
setAuthenticator(javax.mail.Authenticator auth)
Deprecated.since 11.1, this method does nothing, usemail.${protocol}.user
andmail.${protocol}.password
insteadvoid
setConfiguration(Properties config)
void
setCredentials(String user, String pass)
Deprecated.since 11.1, usemail.${protocol}.user
andmail.${protocol}.password
insteadvoid
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 usevoid
setServer(String host, String port, boolean ssl)
-
-
-
Field Detail
-
config
protected Properties config
-
session
protected volatile javax.mail.Session session
-
auth
@Deprecated(since="11.1") protected javax.mail.Authenticator auth
Deprecated.since 11.1, not used anymore
-
-
Constructor Detail
-
Mailer
@Deprecated(since="11.1") public Mailer()
Deprecated.since 11.1, use other constructors insteadCreate a mailer that can be configured using the API.
-
Mailer
public Mailer(Properties config)
Create a mailer that use the given properties to configure the session.
-
Mailer
public Mailer(String sessionName)
Create a mailer using a session that lookup for the session in JNDI under the given session name.
-
Mailer
public Mailer(String sessionName, Properties config)
Create a mailer using a session that lookup for the session in JNDI under the given session name. If the JNDI binding doesn't exists use the given properties to cinfiugure the session.
-
-
Method Detail
-
setServer
public void setServer(String host)
-
setServer
public void setServer(String host, boolean ssl)
-
setCredentials
@Deprecated(since="11.1") public void setCredentials(String user, String pass)
Deprecated.since 11.1, usemail.${protocol}.user
andmail.${protocol}.password
insteadSet SMTP credentials.
-
setAuthenticator
@Deprecated(since="11.1") public void setAuthenticator(javax.mail.Authenticator auth)
Deprecated.since 11.1, this method does nothing, usemail.${protocol}.user
andmail.${protocol}.password
instead
-
setDebug
public void setDebug(boolean debug)
-
getSession
public javax.mail.Session getSession()
-
getConfiguration
public Properties getConfiguration()
-
setConfiguration
public void setConfiguration(Properties config)
-
loadConfiguration
public void loadConfiguration(InputStream in) throws IOException
- Throws:
IOException
-
send
public void send(javax.mail.internet.MimeMessage message) throws javax.mail.MessagingException
- Throws:
javax.mail.MessagingException
-
newMessage
public Mailer.Message newMessage()
-
-