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 classMailer.Message
-
Field Summary
Fields Modifier and Type Field Description protected javax.mail.AuthenticatorauthDeprecated.since 11.1, not used anymoreprotected Propertiesconfigprotected javax.mail.Sessionsessionprotected StringsessionNameThe 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 PropertiesgetConfiguration()javax.mail.SessiongetSession()voidloadConfiguration(InputStream in)Mailer.MessagenewMessage()voidsend(javax.mail.internet.MimeMessage message)voidsendEmail(String from, String to, String subject, String body)Send a single email.voidsetAuthenticator(javax.mail.Authenticator auth)Deprecated.since 11.1, this method does nothing, usemail.${protocol}.userandmail.${protocol}.passwordinsteadvoidsetConfiguration(Properties config)voidsetCredentials(String user, String pass)Deprecated.since 11.1, usemail.${protocol}.userandmail.${protocol}.passwordinsteadvoidsetDebug(boolean debug)voidsetServer(String host)voidsetServer(String host, boolean ssl)voidsetServer(String host, String port)Set the SMTP server address to usevoidsetServer(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}.userandmail.${protocol}.passwordinsteadSet SMTP credentials.
-
setAuthenticator
@Deprecated(since="11.1") public void setAuthenticator(javax.mail.Authenticator auth)
Deprecated.since 11.1, this method does nothing, usemail.${protocol}.userandmail.${protocol}.passwordinstead
-
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()
-
-