I'm generating email messages from within a mailet. How do I create a Return-Path header that's different from the From header? When I create email messages outside James using the JavaMail API, the following code gives me a Return-Path header that's different from the From header. However, the same code in James results in email messages where the Return-Path is taken from the From header (and the values I set in msg.setEnvelopeFrom is ignored).

           Properties props = new Properties();
           Session msess = Session.getDefaultInstance(props, null);
           SMTPMessage msg = new SMTPMessage(msess);

           String bounceAddress = "[EMAIL PROTECTED]";
           msg.setEnvelopeFrom(bounceAddress);
           try {
               msg.setFrom(new InternetAddress("[EMAIL PROTECTED]",
                                               "From Handler"));
               msg.setReplyTo(new InternetAddress[] {
                   new InternetAddress("[EMAIL PROTECTED]",
                                       "Reply Handler")});
           }
           catch (java.io.UnsupportedEncodingException cannotHappen) {}

           msg.setRecipient(Message.RecipientType.TO, "[EMAIL PROTECTED]");
           msg.setSubject("test subject");
           msg.setContent("test message", "text/plain");


Am using James 2.2.0a9 on RedHat Linux 8 with Sun JDK1.4.2.



. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . BOSCO SO www.groundspring.org

Senior Software Engineer, Groundspring.org.  Growing nonprofits
with Internet tools and training.

DonateNow:  Accept credit card donations through your website
EmailNow:  Send eNewsletters and communicate with supporters
   ebase:  Manage your stakeholder relationships

Groundspring.org, P.O. Box 29256, San Francisco, CA 94129-0256
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to