com.noelios.restlet.ext.javamail
Class JavaMailClientHelper

java.lang.Object
  extended by org.restlet.util.Helper
      extended by com.noelios.restlet.ConnectorHelper
          extended by com.noelios.restlet.ClientHelper
              extended by com.noelios.restlet.ext.javamail.JavaMailClientHelper

public class JavaMailClientHelper
extends ClientHelper

Client connector to a mail server. Currently only the SMTP protocol is supported. To send an email, specify a SMTP URI as the ressource reference of the call and use an XML email as the content of the call. An SMTP URI has the following syntax: smtp://host[:port]

The default port used is 25 for SMTP and 465 for SMTPS. Use the Call.getSecurity().setLogin() and setPassword() methods for authentication.

Sample XML email:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<email>
  <head>
    <subject>Account activation</subject>
    <from>support@restlet.org</from>
    <to>user@domain.com</to>
    <cc>log@restlet.org</cc>
  </head>
  <body><![CDATA[Your account was sucessfully created!]]></body>
</email>

Author:
Jerome Louvel (contact@noelios.com)

Constructor Summary
JavaMailClientHelper(Client client)
          Constructor.
 
Method Summary
static Request create(String smtpURI, Representation email)
          Creates a high-level request.
static Request create(String smtpURI, Representation email, String login, String password)
          Creates a high-level request.
 void handle(Request request, Response response)
          Handles a call.
 
Methods inherited from class com.noelios.restlet.ClientHelper
getClient, getContext, getLogger, getParameters
 
Methods inherited from class com.noelios.restlet.ConnectorHelper
createContext, getProtocols, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaMailClientHelper

public JavaMailClientHelper(Client client)
Constructor.

Parameters:
client - The client to help.
Method Detail

create

public static Request create(String smtpURI,
                             Representation email,
                             String login,
                             String password)
Creates a high-level request.

Parameters:
smtpURI - The SMTP server's URI (ex: smtp://localhost).
email - The email to send (valid XML email).
login - Authenticate using this login name.
password - Authenticate using this password.

create

public static Request create(String smtpURI,
                             Representation email)
Creates a high-level request.

Parameters:
smtpURI - The SMTP server's URI (ex: smtp://localhost).
email - The email to send (valid XML email).

handle

public void handle(Request request,
                   Response response)
Handles a call.

Overrides:
handle in class ConnectorHelper
Parameters:
request - The request to handle.
response - The response to update.


Copyright © 2005-2007 Noelios Technologies.