james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Göggerle <andreas.goegge...@pansoft.de>
Subject RE: [PATCH] RemoteDelivery multiple delay times
Date Thu, 30 Oct 2003 14:30:09 GMT
Hi,

I wrote a DSNBounce Mailet (extending Vincenzos AbstractNotify) that
produces Delivery Status Notifications using the format described in RFC
3462 - RFC 3464.
This Mailet gets the failed Message with the Exception that occured attached
as Attribute.

Therefor I replaced the call of "bounce(mail, ex);" at the end of
RemoteDeliverys failMessage() by the following:

// setting attributes for DSN mailet
mail.setAttribute("DSN-error", ex);
mail.setState("dsn");
// 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);
}
// bounce() is no longer needed
//bounce(mail, ex);

so the failed message isn't bounced, but goes to a DSN processor, where the
DSNBounce Mailet does the Bounce and ghosts the original Mail.

in my config.xml I defined a processor "dsn" like this:
<!-- the DSN processor -->
<processor name="dsn">
   <!-- all mails go to the DNSBounce Mailet -->
   <mailet match="All" class="DSNBounce">
      <!-- The sender defaults to the postmaster address -->
      <sender> Mailserver@picard.intern.pansoft.de </sender>
      <!-- Subject prefix, defaults to "Re:" -->
      <prefix> ERROR: </prefix>
      <!-- attachment: how should the original mail be attached? -->
      <!-- MESSAGE or NONE, defaults to MESSAGE -->
      <attachment> MESSAGE </attachment>
      <!-- passThrough, defaults to false -->
      <passThrough> false </passThrough>
      <!-- debug, default = false -->
      <debug> false </debug>
   </mailet>
</processor>

My DSNBounce Mailet could easy be re-written to handle all DSNs, not only
Bounces like it does at the moment. "delayed"-reports and "success"-reports
may be done in this way. But therefor more information must be providet to
the Mailet. I would suggest a DSN-specific Attribute that holds an "Enhanced
Mail System Status Code" (RFC3463). This should be set either by the
SMTP-handler (which could implement RFC3461 - SMTP service extension for
DSN) or by RemoteDelivery. At the moment my Mailet is "guessing" this Status
Code using the exception catched in RemoteDelivery.

But i still have one (minor?) problem with my Mailet to be RFC conform:
JavaMail 1.3.1 doesn't support the MIME-Type "message/delivery-status" and I
don't have the time to look at the JavaBeans Activation Framework for
writing an own DataContentHandler for this MIME-Type. At the monent I send
the delivery-report as MIME-Type "text/plain". If someone is willing to do
the DataContentHandler or if you want to accept it even if it's not 100% RFC
conform I can contribute the current Mailet.

Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message