[ 
https://issues.apache.org/jira/browse/JAMES-1403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17878998#comment-17878998
 ] 

Benoit Tellier commented on JAMES-1403:
---------------------------------------

This would allow to skip some processing I imagine. Or maybe apply special 
treatments to the bounce emitted by the platform.

This method is however deprecated / unused, if it makes sens (i also do not 
fully grasp the why) it would likely make more sens to put this as a parameter 
to the Bounce / DSNBounce mailet

> Adding overloaded MailetContext/JamesMailetContext.bounce() method with a 
> state parameter
> -----------------------------------------------------------------------------------------
>
>                 Key: JAMES-1403
>                 URL: https://issues.apache.org/jira/browse/JAMES-1403
>             Project: James Server
>          Issue Type: Improvement
>          Components: James Core
>    Affects Versions: 3.0-beta3
>         Environment: All
>            Reporter: Idea Harness
>            Priority: Major
>
> 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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to