On 1/12/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Author: joachim
Date: Fri Jan 12 13:40:47 2007
New Revision: 495746

<snip>

Added: 
james/server/trunk/src/java/org/apache/james/transport/mailets/sieve/SieveToMultiMailbox.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/transport/mailets/sieve/SieveToMultiMailbox.java?view=auto&rev=495746
==============================================================================
--- 
james/server/trunk/src/java/org/apache/james/transport/mailets/sieve/SieveToMultiMailbox.java
 (added)
+++ 
james/server/trunk/src/java/org/apache/james/transport/mailets/sieve/SieveToMultiMailbox.java
 Fri Jan 12 13:40:47 2007

<snip>

+public class SieveToMultiMailbox extends GenericMailet {

<snip>

+    void storeMessageSieve(String sieveFileName, Mail aMail) throws 
MessagingException {
+        // Evaluate the script against the mail
+        try
+        {
+            MailAdapter aMailAdapter = new SieveMailAdapter(aMail,
+                    getMailetContext());
+            log("Evaluating " + aMailAdapter.toString() + "against \""
+                    + sieveFileName + "\"");
+            SieveFactory.getInstance().evaluate(aMailAdapter,
+                    SieveFactory.getInstance().parse(new 
FileInputStream(sieveFileName)));
+        }
+        catch (Exception ex)
+        {
+            log("Exception evaluating Sieve script", ex);
+            // If there were errors, we redirect the email to the ERROR
+            // processor.
+            // In order for this server to meet the requirements of the SMTP
+            // specification,
+            // mails on the ERROR processor must be returned to the sender.
+            // Note that this
+            // email doesn't include any details regarding the details of the
+            // failure(s).
+            // In the future we may wish to address this.
+            getMailetContext().sendMail(aMail.getSender(),
+                    aMail.getRecipients(), aMail.getMessage(), Mail.ERROR);
+            throw new MessagingException("Exception evaluating Sieve script",
+                    ex);
+        }
+    }

i'm not sure that this is the right choice. the sieve script just
performs filtering. in the event of an error, i'd expect the mail to
remain unfiltered.

a typical use case for filtering would be using fetchpop rather than
running a full SMTP server. pretty nasty for users to lose a load of
email when they make a mistake in their filter or when they discover a
bug in the james implementation.

- robert

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to