hilmer 2004/03/22 14:04:19
Modified: src/java/org/apache/james/transport/mailets Tag:
branch_2_1_fcs RemoteDelivery.java
src/xdocs Tag: branch_2_1_fcs provided_mailets_2_1.xml
Log:
Submitted by: Andreas G�ggerle
Reviewed by: hilmer
[JAMES-234] Adds RemoteDelivery support for improved DSN processing. See problem
description in JIRA
Revision Changes Path
No revision
No revision
1.33.4.18 +22 -2
james-server/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
Index: RemoteDelivery.java
===================================================================
RCS file:
/home/cvs/james-server/src/java/org/apache/james/transport/mailets/RemoteDelivery.java,v
retrieving revision 1.33.4.17
retrieving revision 1.33.4.18
diff -u -r1.33.4.17 -r1.33.4.18
--- RemoteDelivery.java 20 Mar 2004 07:50:42 -0000 1.33.4.17
+++ RemoteDelivery.java 22 Mar 2004 22:04:18 -0000 1.33.4.18
@@ -54,6 +54,7 @@
import org.apache.james.services.MailServer;
import org.apache.james.services.MailStore;
import org.apache.james.services.SpoolRepository;
+import org.apache.mailet.MailetContext;
import org.apache.mailet.GenericMailet;
import org.apache.mailet.HostAddress;
import org.apache.mailet.Mail;
@@ -207,6 +208,7 @@
private Collection deliveryThreads = new Vector();
private MailServer mailServer;
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
private Perl5Matcher delayTimeMatcher; //matcher use at init time to parse
delaytime parameters
private MultipleDelayFilter delayFilter = new MultipleDelayFilter ();//used by
accept to selcet the next mail ready for processing
@@ -280,6 +282,8 @@
}
sendPartial = (getInitParameter("sendpartial") == null) ? false : new
Boolean(getInitParameter("sendpartial")).booleanValue();
+ bounceProcessor = getInitParameter("bounceProcessor");
+
String gateway = getInitParameter("gateway");
String gatewayPort = getInitParameter("gatewayPort");
@@ -669,7 +673,23 @@
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;
}
No revision
No revision
1.5.4.8 +6 -0 james-server/src/xdocs/provided_mailets_2_1.xml
Index: provided_mailets_2_1.xml
===================================================================
RCS file: /home/cvs/james-server/src/xdocs/provided_mailets_2_1.xml,v
retrieving revision 1.5.4.7
retrieving revision 1.5.4.8
diff -u -r1.5.4.7 -r1.5.4.8
--- provided_mailets_2_1.xml 9 Feb 2004 16:20:45 -0000 1.5.4.7
+++ provided_mailets_2_1.xml 22 Mar 2004 22:04:19 -0000 1.5.4.8
@@ -201,6 +201,12 @@
default local address of the machine. This tag is useful for multihomed
machines.<br/>
Note: Currently you must use the same IP address for all of those RemoteDelivery
instances where you explicitly supply a bind address.</li>
+<li><strong>bounceProcessor</strong> - If present, this value is the
+name of a spool processor, on which mails that, are to bounce due to
+undeliverability, are sent. An exception carrying information about the
+cause of undeliverability, is added as a MailAttribute with name: delivery-error.
+If not present the mail is simply bounced to the sender, with a
+standard (hardcoded) undeliverability message.
<li><strong>debug</strong> (optional) - a boolean value (true/false) indicating
whether debugging is
on. Defaults to false.</li>
</ul>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]