org.apache.james.transport.mailets
Class RemoteDelivery

java.lang.Object
  extended by org.apache.mailet.base.GenericMailet
      extended by org.apache.james.transport.mailets.RemoteDelivery
All Implemented Interfaces:
java.lang.Runnable, org.apache.mailet.Mailet, org.apache.mailet.MailetConfig

public class RemoteDelivery
extends org.apache.mailet.base.GenericMailet
implements java.lang.Runnable

Receives a MessageContainer from JamesSpoolManager and takes care of delivery the message to remote hosts. If for some reason mail can't be delivered store it in the "outgoing" Repository and set an Alarm. After the next "delayTime" the Alarm will wake the servlet that will try to send it again. After "maxRetries" the mail will be considered undeliverable and will be returned to sender.

TO DO (in priority):

  1. Support a gateway (a single server where all mail will be delivered) (DONE)
  2. Provide better failure messages (DONE)
  3. More efficiently handle numerous recipients
  4. Migrate to use Phoenix for the delivery threads

You really want to read the JavaMail documentation if you are working in here, and you will want to view the list of JavaMail attributes, which are documented here as well as other places.

Version:
CVS $Revision: 767520 $ $Date: 2009-04-22 14:38:29 +0100 (Wed, 22 Apr 2009) $

Constructor Summary
RemoteDelivery()
           
 
Method Summary
 void destroy()
          Stops all the worker threads that are waiting for messages.
 java.lang.String getMailetInfo()
           
 void init()
          Initializes all arguments based on configuration values specified in the James configuration file.
protected  javax.mail.Session obtainSession(java.util.Properties props)
          Returns the javamail Session object.
 void run()
          Handles checking the outgoing spool for new mail and delivering them if there are any
 void service(org.apache.mailet.Mail mail)
          For this message, we take the list of recipients, organize these into distinct servers, and duplicate the message for each of these servers, and then call the deliver (messagecontainer) method for each server-specific messagecontainer ...
protected  void setDNSServer(DNSService dnsServer)
          Setter for the dnsserver service
 
Methods inherited from class org.apache.mailet.base.GenericMailet
arrayToString, checkInitParameters, getInitParameter, getInitParameter, getInitParameter, getInitParameterNames, getMailetConfig, getMailetContext, getMailetName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteDelivery

public RemoteDelivery()
Method Detail

init

public void init()
          throws javax.mail.MessagingException
Initializes all arguments based on configuration values specified in the James configuration file.

Overrides:
init in class org.apache.mailet.base.GenericMailet
Throws:
javax.mail.MessagingException - on failure to initialize attributes.

getMailetInfo

public java.lang.String getMailetInfo()
Specified by:
getMailetInfo in interface org.apache.mailet.Mailet
Overrides:
getMailetInfo in class org.apache.mailet.base.GenericMailet

service

public void service(org.apache.mailet.Mail mail)
             throws javax.mail.MessagingException
For this message, we take the list of recipients, organize these into distinct servers, and duplicate the message for each of these servers, and then call the deliver (messagecontainer) method for each server-specific messagecontainer ... that will handle storing it in the outgoing queue if needed.

Specified by:
service in interface org.apache.mailet.Mailet
Specified by:
service in class org.apache.mailet.base.GenericMailet
Parameters:
mail - org.apache.mailet.Mail
Throws:
javax.mail.MessagingException

destroy

public void destroy()
Stops all the worker threads that are waiting for messages. This method is called by the Mailet container before taking this Mailet out of service.

Specified by:
destroy in interface org.apache.mailet.Mailet
Overrides:
destroy in class org.apache.mailet.base.GenericMailet

run

public void run()
Handles checking the outgoing spool for new mail and delivering them if there are any

Specified by:
run in interface java.lang.Runnable

obtainSession

protected javax.mail.Session obtainSession(java.util.Properties props)
Returns the javamail Session object.

Parameters:
props -
authenticator -
Returns:

setDNSServer

protected void setDNSServer(DNSService dnsServer)
Setter for the dnsserver service

Parameters:
dnsServer - dns service


Copyright ? 2002-2009 The Apache Software Foundation. All Rights Reserved.