Ah, I understand, I could make a matcher do the work. However, in this case I would 
like to concentrate all my logic in one mailet, since selecting the recipient list and 
manipulating the message is strongly linked. But I will keep it in the back of my mind 
that I can use a matcher to accomplish this.

So, if I take the suggested code

    Mail mail = ...; // Mail object containing the Message
    List recipients1 = ...; 
    List recipients2 = ...; 

    context.sendMail(mail.getSender(), recipients1, mail.getMessage());
    context.sendMail(mail.getSender(), recipients2, mail.getMessage());

is it ok to cancel the original message by saying

    mail.setMessage(null);

or is there another way? 
Or I do I have to make a change in my James configuration? (I'd rather not)

thanks for your help!

    Hes.


  ----- Original Message ----- 
  From: Noel J. Bergman 
  To: James Users List 
  Sent: Tuesday, August 19, 2003 22:31
  Subject: RE: Splitting a message


  > I am writing a maillet that will split a message with multiple
  > recipients into two messages.

  You do realize that James does that automatically?  That is exactly what
  happens inside the pipeline.  The result of a matcher is a list of
  recipients.  If the list of matched recipients is not the entire list, the
  list is split.  The matched set is attached to a message handled to the
  mailet, the other set is attached to a message that skips the mailet.

  > the Mail class has a method setRecipients().

  The site docs reflect the development version of the API.  The official API
  is part of the distribution.  There aren't that many changes, but you hit on
  one.  It isn't necessary, as there are other ways to attach a recipient list
  to a message.

  --- Noel


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




------------------------------------------------------------------------------


            The sender of this message has not signed this message or used encryption 
to improve privacy.      

Reply via email to