Hi,

I think it would be very useful to add an overloaded bounce() method
to org.apache.mailet.MailetContext and
org.apache.james.mailetcontainer.impl.JamesMailetContext
accepting a String state parameter (similar to a sendMail() method
that already has it) with the following implementation :


   public void bounce(Mail mail, String message, MailAddress bouncer,
String state) throws MessagingException {

        if (mail.getSender() == null) {
            if (log.isInfoEnabled())
                log.info("Mail to be bounced contains a null (<>)
reverse path.  No bounce will be sent.");
            return;
        } else {
            // Bounce message goes to the reverse path, not to the Reply-To
            // address
            if (log.isInfoEnabled())
                log.info("Processing a bounce request for a message
with a reverse path of " + mail.getSender().toString());
        }

        MailImpl reply = rawBounce(mail, message);
        // Change the sender...
        reply.getMessage().setFrom(bouncer.toInternetAddress());
        reply.getMessage().saveChanges();
        // Send it off ... with null reverse-path
        reply.setSender(null);

        // Set the specified state, which is not necessarily the root state
        reply.setState(state);

        sendMail(reply);
        LifecycleUtil.dispose(reply);
    }

This would allow the callers to specify the state of the bounced
(reply) Mail, rather than going to the root state as is now.

Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to