org.apache.servicemix.mail
Class MailSenderEndpoint

java.lang.Object
  extended by org.apache.servicemix.common.endpoints.AbstractEndpoint
      extended by org.apache.servicemix.common.endpoints.SimpleEndpoint
          extended by org.apache.servicemix.common.endpoints.ProviderEndpoint
              extended by org.apache.servicemix.mail.MailSenderEndpoint
All Implemented Interfaces:
Endpoint, MailEndpointType

public class MailSenderEndpoint
extends ProviderEndpoint
implements MailEndpointType

this is the sending endpoint for the mail component

Author:
lhein

Field Summary
 
Fields inherited from class org.apache.servicemix.common.endpoints.AbstractEndpoint
definition, description, endpoint, interfaceName, service, serviceUnit
 
Constructor Summary
MailSenderEndpoint()
           
 
Method Summary
 java.lang.String getConnection()
           
 java.util.Map<java.lang.String,java.lang.String> getCustomProperties()
           
 java.lang.String getCustomTrustManagers()
           
 IgnoreList getIgnoreMessageProperties()
           
 AbstractMailMarshaler getMarshaler()
           
 java.lang.String getReceiver()
           
 java.lang.String getSender()
           
 boolean isDebugMode()
           
protected  void processInOnly(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.NormalizedMessage in)
           
protected  void processInOut(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.NormalizedMessage in, javax.jbi.messaging.NormalizedMessage out)
           
 void setConnection(java.lang.String connection)
          Specifies the connection URI used to connect to a mail server.
 void setCustomProperties(java.util.Map<java.lang.String,java.lang.String> customProperties)
          Specifies a java.util.Map which may contain additional properties for the connection.
 void setCustomTrustManagers(java.lang.String customTrustManagers)
          Specifies one or more trust manager classes separated by a semicolon (;).
These classes have to implement the Trustmanager interface and need to provide an empty default constructor to be valid.

If you want to accept all security certificates without a check you may consider using the DummyTrustManager class.
 void setDebugMode(boolean debugMode)
          Specifies if the JavaMail is run in DEBUG mode.
 void setIgnoreMessageProperties(IgnoreList ignoreMessageProperties)
          Specifies a java.util.List which may contain message properties to skip.
 void setMarshaler(AbstractMailMarshaler marshaler)
          With this method you can specify a marshaler class which provides the logic for converting a normalized message into a mail.
 void setReceiver(java.lang.String receiver)
          Specifies the receiver address(es) of the mail which is being sent.
 void setSender(java.lang.String sender)
          Specifies the sender address of the mail which is being sent.
 void validate()
           
 
Methods inherited from class org.apache.servicemix.common.endpoints.ProviderEndpoint
activate, deactivate, getRole, process
 
Methods inherited from class org.apache.servicemix.common.endpoints.SimpleEndpoint
done, fail, getChannel, getContext, getExchangeFactory, send, sendSync, start, stop
 
Methods inherited from class org.apache.servicemix.common.endpoints.AbstractEndpoint
getDefinition, getDescription, getEndpoint, getInterfaceName, getKey, getService, getServiceUnit, isExchangeOkay, prepareExchange, setDefinition, setDescription, setEndpoint, setInterfaceName, setService, setServiceUnit, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MailSenderEndpoint

public MailSenderEndpoint()
Method Detail

validate

public void validate()
              throws javax.jbi.management.DeploymentException
Specified by:
validate in interface Endpoint
Overrides:
validate in class AbstractEndpoint
Throws:
javax.jbi.management.DeploymentException

processInOnly

protected void processInOnly(javax.jbi.messaging.MessageExchange exchange,
                             javax.jbi.messaging.NormalizedMessage in)
                      throws java.lang.Exception
Overrides:
processInOnly in class ProviderEndpoint
Throws:
java.lang.Exception

processInOut

protected void processInOut(javax.jbi.messaging.MessageExchange exchange,
                            javax.jbi.messaging.NormalizedMessage in,
                            javax.jbi.messaging.NormalizedMessage out)
                     throws java.lang.Exception
Overrides:
processInOut in class ProviderEndpoint
Throws:
java.lang.Exception

getMarshaler

public AbstractMailMarshaler getMarshaler()

setMarshaler

public void setMarshaler(AbstractMailMarshaler marshaler)

With this method you can specify a marshaler class which provides the logic for converting a normalized message into a mail. This class has to extend the abstract class AbstractMailMarshaler or an extending class. If you don't specify a marshaler, the DefaultMailMarshaler will be used.

Parameters:
marshaler - a class which extends AbstractMailMarshaler

getSender

public java.lang.String getSender()

setSender

public void setSender(java.lang.String sender)

Specifies the sender address of the mail which is being sent.

   The default value is no-reply@localhost

Parameters:
sender - a String value containing the sender address

getConnection

public java.lang.String getConnection()

setConnection

public void setConnection(java.lang.String connection)

Specifies the connection URI used to connect to a mail server.

Templates:
   <protocol>://<user>@<host>[:<port>][/<folder>]?password=<password>
      OR
   <protocol>://<host>[:<port>][/<folder>]?user=<user>;password=<password>

Details:

Name Description
protocol the protocol to use (example: pop3 or imap)
user the user name used to log into an account
host the name or ip address of the mail server
port the port number to use (optional)
folder the folder to poll from (optional)
password the password for the login

Example:
   smtp://lhein@myserver?password=myPass

   The default value is null

Parameters:
connection - a String value containing the connection details

isDebugMode

public boolean isDebugMode()

setDebugMode

public void setDebugMode(boolean debugMode)

Specifies if the JavaMail is run in DEBUG mode. This means that while connecting to server and processing mails a detailed log is written to debug output.
This mode is very handy if you are experiencing problems with your mail server connection and you want to find out what is going wrong in communication with the server.

   true - the debug mode is enabled
   false - the debug mode is disabled

   The default value is false

Parameters:
debugMode - a boolean value for debug mode

getCustomTrustManagers

public java.lang.String getCustomTrustManagers()

setCustomTrustManagers

public void setCustomTrustManagers(java.lang.String customTrustManagers)

Specifies one or more trust manager classes separated by a semicolon (;).
These classes have to implement the Trustmanager interface and need to provide an empty default constructor to be valid.

If you want to accept all security certificates without a check you may consider using the DummyTrustManager class. It is actually only an empty stub without any checking logic.
But be aware that this will be a security risk in production environments.

   The default value is null

Parameters:
customTrustManagers - a String value containing one or more full class names separated by ; char

getReceiver

public java.lang.String getReceiver()

setReceiver

public void setReceiver(java.lang.String receiver)

Specifies the receiver address(es) of the mail which is being sent.

   The default value is null

Parameters:
receiver - a String value containing the receiver address(es)

getCustomProperties

public java.util.Map<java.lang.String,java.lang.String> getCustomProperties()

setCustomProperties

public void setCustomProperties(java.util.Map<java.lang.String,java.lang.String> customProperties)

Specifies a java.util.Map which may contain additional properties for the connection.

Example for disabling TOP for POP3 headers:
 key: "mail.pop3.disabletop"
 value: "true"

   The default value is null

Parameters:
customProperties - a java.util.Map<String, String> containing connection properties

getIgnoreMessageProperties

public IgnoreList getIgnoreMessageProperties()

setIgnoreMessageProperties

public void setIgnoreMessageProperties(IgnoreList ignoreMessageProperties)

Specifies a java.util.List which may contain message properties to skip.

Example for skipping all kind of addresses from the normalized message:
 value: "org.apache.servicemix.mail.to"
 value: "org.apache.servicemix.mail.cc"
 value: "org.apache.servicemix.mail.bcc"
 value: "org.apache.servicemix.mail.from"
 value: "org.apache.servicemix.mail.replyto"

   The default value is null

Parameters:
ignoreMessageProperties - a list containing keys of properties to ignore
See Also:
IgnoreList


Copyright © 2005-2012 FuseSource. All Rights Reserved.