Sieve Proposal (Request For Comments)
Hi, Following on from the discussions in the Future Directions thread, and in particular the final part of http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED] .orgmsgId=1146701, here is a proposal on how to implement Sieve. 1) Implement a Java implementation of Sieve that... a) Accepts a script read from a java.io.InputStream and a javax.mail.internet.MailMessage as input. b) Defines the RFC3028 required commands and tests as interfaces. c) Implement the interfaces in (1b) above where no specific mail processing is required. 2) Using JavaMail... a) Implement any remaining interfaces from (1b) not implemented by (1c) where JavaMail provides the required functionality. b) Optionally, implement Vendor Defined Extensions, as defined in RFC3028 Section 6, to exploit extra JavaMail functionality as desired. 3) Using James[1]... a) Provide a mechanism(s) for invoking the Java implementation of Sieve described in (1) above. b) Implement any remaining interfaces from (1b) not implemented by (1c) or (2a) using James specific functionality. c) Optionally, implement Vendor Defined Extensions, as defined in RFC3028 Section 6, to exploit extra James functionality as desired. In this layered approach, layers 1 and 2 do not have anything to do with James at all. Still, within Apache, James seems the most fertile ground in which to grow them. Layer 3 touches James. Within James, the mechanism(s) of (3a) maybe via one or more of a Sieve container[2], a mailet, something new. To prove to myself that this is do-able in a reasonable time-frame, I created... - A parseable definition of the Sieve grammar expressed in JavaCC which correctly parses all of the Sieve script examples in RFC3028. - An interpreter, which executes the parsed objects, invoking Sieve Commands and Tests against a MailMessage. So, that's step (1) above almost done (I got a little carried away)! I MAY go further and complete at least (2) above, but first... ? Is the proposal described above the correct way of implementing Sieve ? I have worked out a way to do this stuff, but before I expend the time and effort on a full scale implementation, it would be good to get a consensus confirming that this is the right way to go about it. Hence, RFC! -- Steve [1] Any other Java enabled thing that delivers the required functionality could be used. [2] The container refactoring work will need to be done before this. - - - - - - - - - - - - - - - - - - This private and confidential e-mail has been sent to you by Synergy Systems Limited. It may not represent the views of Synergy Systems Limited. If you are not the intended recipient of this e-mail and have received it in error, please notify the sender by replying with received in error as the subject and then delete it from your mailbox. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[PATCH] RemoteDelivery and new DSNBounce Mailet
Hi, finaly I got time to get things ready. This Patch to RemoteDelivery introduces a new parameter dsnProcessor. Here you can specify a processor, where DSN conform Bounces are created. If this parameter is missing, mails get bounced the old way. Here is a configuration example: processor name=transport [...] mailet match=All class=RemoteDelivery [...] !-- Processor for DSN creation -- dsnProcessordsn/dsnProcessor /mailet /processor processor name=dsn mailet match=All class=DSNBounce !-- sender defaults to postmaster -- sender [EMAIL PROTECTED] /sender !-- Subject Prefix (default=Re:) -- prefix ERROR: /prefix passThrough false /passThrough /mailet /processor The DSNBounce Mailet creates Bounce Mails in the format specified by RFCs 3462 to 3464. There is only one discrepancy: the MIME-type text/plain is used for the status-report part, instead of message/delivery-status. JavaMail doesn't support message/delivery-status. Andreas *** Mail: [EMAIL PROTECTED] Web: www.pansoft.de Tel.: +49 (0)721 62532 - 16 Fax: +49 (0)721 62532 - 44 PANSOFT GmbH Tullastr. 28 76131 Karlsruhe *** Index: RemoteDelivery.java === RCS file: /home/cvspublic/james-server/src/java/org/apache/james/transport/mailets/RemoteDelivery.java,v retrieving revision 1.51 diff -u -r1.51 RemoteDelivery.java --- RemoteDelivery.java 18 Jun 2003 15:59:44 - 1.51 +++ RemoteDelivery.java 27 Nov 2003 16:21:02 - @@ -89,6 +89,7 @@ import org.apache.mailet.GenericMailet; import org.apache.mailet.Mail; import org.apache.mailet.MailAddress; +import org.apache.mailet.MailetContext; import org.apache.mailet.MailetContextConstants; import org.apache.mailet.SpoolRepository; @@ -138,6 +139,7 @@ private Collection deliveryThreads = new Vector(); private volatile boolean destroyed = false; //Flag that the run method will check and end itself if set to true +private String dsnProcessor = null; // the processor for creating DSNs /** * Initialize the mailet @@ -174,6 +176,7 @@ log(Invalid timeout setting: + getInitParameter(timeout)); } sendPartial = (getInitParameter(sendpartial) == null) ? false : new Boolean(getInitParameter(sendpartial)).booleanValue(); +dsnProcessor = getInitParameter(dsnProcessor); String gateway = getInitParameter(gateway); gatewayPort = getInitParameter(gatewayPort); @@ -543,7 +546,25 @@ log(logBuffer.toString()); } } -bounce(mail, ex); + +if (dsnProcessor != null) { +// do the new DSN bounce +// setting attributes for DSN mailet +mail.setAttribute(DSN-error, ex); +mail.setState(dsnProcessor); +// re-insert the mail into the spool for getting it passed to the dsn-processor +MailetContext mc = getMailetContext(); +try { +mc.sendMail(mail); +} catch (MessagingException e) { +// we shouldn't get an exception, because the mail was already processed +log(Exception re-inserting failed mail: , e); +} +} else { +// do an old style bounce +bounce(mail, ex); +} + return true; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sieve Proposal (Request For Comments)
Steve Brewin wrote: Following on from the discussions in the Future Directions thread, and in particular the final part of http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED] .orgmsgId=1146701, here is a proposal on how to implement Sieve. Sounds great to me. I think it would be helpful to create some unit tests (sample messages and sample sieve scripts) for 1. That could be a separate repository we host. I thought that mailets could be added as sieve extensions, but that may or may not be germane to what you're currently working on. -- Serge Knystautas President Lokitech software . strategy . design http://www.lokitech.com p. 301.656.5501 e. [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]