Hi Raphael,

I created a matcher and remover that take care of the per recipient headers
as well as the global ones. I copied the existing ones (with their tests)
and added the use cases for per recipient.
They are currently available there:

   -
   
https://github.com/foilen/james-extra-components/blob/master/src/main/java/com/foilen/james/components/mailet/RemoveHeaderGlobalAndSpecific.java
   -
      
https://github.com/foilen/james-extra-components/blob/master/src/test/java/com/foilen/james/components/mailet/RemoveHeaderGlobalAndSpecificTest.java
      -
   
https://github.com/foilen/james-extra-components/blob/master/src/main/java/com/foilen/james/components/matcher/HasHeaderGlobalAndSpecific.java
   -
      
https://github.com/foilen/james-extra-components/blob/master/src/test/java/com/foilen/james/components/matcher/HasHeaderGlobalAndSpecificTest.java

I would like to add them in the James project, so I will create a Jira for
them, but I wanted to know what names would you suggest? Mine are pretty
long, so I would like to know your thoughts.

Thanks

On Thu, 7 Mar 2019 at 10:05, Raphael OUAZANA <raphael.ouaz...@linagora.com>
wrote:

> Hi,
>
> You are right HasHeader does not handle perRecipientHeaders.
>
> I'm not sure of the good solution for this: either you can modify
> HasHeader to return a list of recipients depending on
> perRecipientHeaders (a.), or you can write an other matcher (b.).
> Given the documentation I think (b.) would be more appropriate, but
> other advices are very welcome.
>
> Regards,
> Raphaël.
>
> Le 2019-03-06 12:55, Simon Levesque a écrit :
> > Hi,
> > I added that logic to add an header per recipient, but it is being
> > ignored by HasHeader .
> >
> > E.g. in my logs, I can see:
> >
> > INFO   | jvm 1    | 2019/03/06 11:44:48 | ---[Mail - Recipients]---
> > INFO   | jvm 1    | 2019/03/06 11:44:48 | suriv...@gmail.com
> > INFO   | jvm 1    | 2019/03/06 11:44:48 | si...@nnnn.com
> > INFO   | jvm 1    | 2019/03/06 11:44:48 | ---[Mail - Headers Per
> > Recipient]---
> > INFO   | jvm 1    | 2019/03/06 11:44:48 | si...@nnnn.com :
> > isRedirection -> true
> >
> > and
> >
> >       <mailet match="HasHeader=isRedirection"
> > class="com.foilen.james.components.mailet.LogInfo">
> >         <text>Recipient is ExactAndCatchAllRedirections</text>
> >       </mailet>
> > is not catching it. If I put the header on the message itself, then it
> > is getting it.
> >
> > Is it a bug in the matcher? Should I use another matcher?
> > thanks
> >
> > On Mon, 4 Mar 2019 at 10:06, Simon Levesque <suriv...@gmail.com>
> > wrote:
> >
> >> Great, i will try that.
> >> Thanks
> >>
> >> Le lun. 4 mars 2019 08:02, Raphael OUAZANA
> >> <raphael.ouaz...@linagora.com> a écrit :
> >>
> >>> Hi,
> >>>
> >>> Le 2019-03-04 13:16, Simon Levesque a écrit :
> >>>> Hi all,
> >>>>
> >>>> I created a mailet that modifies some recipients. When modifying
> >>> them,
> >>>> I
> >>>> want to add an header only to those modified.
> >>>> Given the method's signature:
> >>>>
> >>>> public void service(Mail mail) throws MessagingException {
> >>>>
> >>>> It looks like I can only modify one mail.
> >>>>
> >>>> From the documentation, I recal that if one message has 5
> >>> recipients,
> >>>> then
> >>>> they would be splited in 5 messages (one per recipient) and
> >>> being
> >>>> processed
> >>>> individually, but in pratice, I am not seing that.
> >>>> Is there a way to do any of these:
> >>>>
> >>>> 1. configure something to have one mail per recipient
> >>>> 2. from a mailet, split a mail in 2 or call a service to
> >>> create a
> >>>> new
> >>>> mail
> >>>
> >>> Something has been added recently exactly for this purpose:
> >>> perRecipientHeaders.
> >>>
> >>> See Mail.addSpecificHeaderForRecipient and
> >>> Mail.getPerRecipientSpecificHeaders.
> >>>
> >>> Regards,
> >>> Raphaël Ouazana.
>

Reply via email to