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 --> <dsnProcessor>dsn</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 -0000 1.51 +++ RemoteDelivery.java 27 Nov 2003 16:21:02 -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 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]