Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.automation.core.mail
Class Mailer

java.lang.Object
  extended by org.nuxeo.ecm.automation.core.mail.Mailer

public class Mailer
extends java.lang.Object

Author:
Bogdan Stefanescu

Nested Class Summary
static class Mailer.Message
           
 
Constructor Summary
Mailer()
          Create a mailer that can be configured using the API.
Mailer(java.util.Properties config)
          Create a mailer that use the given properties to configure the session.
Mailer(java.lang.String sessionName)
          Create a mailer using a session that lookup for the session in JNDI under the given session name.
Mailer(java.lang.String sessionName, java.util.Properties config)
          Create a mailer using a session that lookup for the session in JNDI under the given session name.
 
Method Summary
 java.util.Properties getConfiguration()
           
 javax.mail.Session getSession()
           
 void loadConfiguration(java.io.InputStream in)
           
 Mailer.Message newMessage()
           
 void send(javax.mail.internet.MimeMessage message)
           
 void sendEmail(java.lang.String from, java.lang.String to, java.lang.String subject, java.lang.String body)
          Send a single email.
 void setAuthenticator(javax.mail.Authenticator auth)
           
 void setConfiguration(java.util.Properties config)
           
 void setCredentials(java.lang.String user, java.lang.String pass)
          Set SMTP credential
 void setDebug(boolean debug)
           
 void setServer(java.lang.String host)
           
 void setServer(java.lang.String host, boolean ssl)
           
 void setServer(java.lang.String host, java.lang.String port)
          Set the SMTP server address to use
 void setServer(java.lang.String host, java.lang.String port, boolean ssl)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mailer

public Mailer()
Create a mailer that can be configured using the API.

See Also:
setAuthenticator(Authenticator), setCredentials(String, String), setServer(String)

Mailer

public Mailer(java.util.Properties config)
Create a mailer that use the given properties to configure the session.

Parameters:
config -

Mailer

public Mailer(java.lang.String sessionName)
Create a mailer using a session that lookup for the session in JNDI under the given session name.

Parameters:
sessionName -

Mailer

public Mailer(java.lang.String sessionName,
              java.util.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.

Parameters:
sessionName -
config -
Method Detail

setServer

public void setServer(java.lang.String host)

setServer

public void setServer(java.lang.String host,
                      boolean ssl)

setServer

public void setServer(java.lang.String host,
                      java.lang.String port)
Set the SMTP server address to use

Parameters:
host -
port -

setServer

public void setServer(java.lang.String host,
                      java.lang.String port,
                      boolean ssl)

setCredentials

public void setCredentials(java.lang.String user,
                           java.lang.String pass)
Set SMTP credential

Parameters:
user -
pass -

setAuthenticator

public void setAuthenticator(javax.mail.Authenticator auth)

setDebug

public void setDebug(boolean debug)

getSession

public javax.mail.Session getSession()

getConfiguration

public java.util.Properties getConfiguration()

setConfiguration

public void setConfiguration(java.util.Properties config)
                      throws java.lang.Exception
Throws:
java.lang.Exception

loadConfiguration

public void loadConfiguration(java.io.InputStream in)
                       throws java.lang.Exception
Throws:
java.lang.Exception

send

public void send(javax.mail.internet.MimeMessage message)
          throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

newMessage

public Mailer.Message newMessage()

sendEmail

public void sendEmail(java.lang.String from,
                      java.lang.String to,
                      java.lang.String subject,
                      java.lang.String body)
               throws javax.mail.MessagingException
Send a single email.

Throws:
javax.mail.MessagingException

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.