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


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);

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

       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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
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