> Two things...
> 1. You only attached the RemoteDelivery patch, not the
> DSNBounce mailet.
I dont't know why the mailet was not there, I'm sure I attached both .. but
here it is again.

> 2. The change to remote delivery... other people have
> requested handling
> how bounces work, so I might suggest we make this more generic.
> Basically the code would stay the same, just remove the DSN-specific
> naming, e.g., configure a <bounceProcessor> and store the
> exception as the delivery-error.
My intention was to use this processor not only for bounces, but also for
positive and delayed DSNs once the required information is available
(i.e. the SMTP extension for DSN is implemented), so I named it
<dsnProcessor>.
But if you prefer <bounceProcessor> ... it's changed in the patch I send
this time.

I hope this time both attachements make the way to you, but I'll doublecheck

Andreas

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 -0000      1.51
+++ RemoteDelivery.java 2 Dec 2003 08:41:13 -0000
@@ -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 bounceProcessor = null; // the processor for creating Bounces
 
     /**
      * Initialize the mailet
@@ -174,6 +176,7 @@
             log("Invalid timeout setting: " + getInitParameter("timeout"));
         }
         sendPartial = (getInitParameter("sendpartial") == null) ? false : new 
Boolean(getInitParameter("sendpartial")).booleanValue();
+        bounceProcessor = getInitParameter("bounceProcessor");
 
         String gateway = getInitParameter("gateway");
         gatewayPort = getInitParameter("gatewayPort");
@@ -543,7 +546,25 @@
                 log(logBuffer.toString());
             }
         }
-        bounce(mail, ex);
+
+        if (bounceProcessor != null) {
+            // do the new DSN bounce
+            // setting attributes for DSN mailet
+            mail.setAttribute("delivery-error", ex);
+            mail.setState(bounceProcessor);
+            // 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]

Reply via email to