You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Mihai Zamfira <mi...@logika.ro.INVALID> on 2023/06/11 07:00:05 UTC

Sieve mailet error

Hi,
im using a james 3.8  with cassandra and opensearch.

my “local-delivery” processor configuration looks like below .

<processor state="local-delivery" enableJmx="true">
            <mailet match="All" class="VacationMailet">
                <onMailetException>ignore</onMailetException>
            </mailet>
            <mailet match="All" class="Sieve">
                <onMailetException>ignore</onMailetException>
            </mailet>
            <mailet match="All" class="AddDeliveredToHeader"/>
            <mailet match="All" class="org.apache.james.jmap.mailet.filter.JMAPFiltering">
                <onMailetException>ignore</onMailetException>
            </mailet>
            <mailet match="All" class="LocalDelivery"/>
</processor>

The problem appears when an email with 2 or more local recipients it’s received and Sieve it throw the following error "Invalid number of recipients - 2. Exactly 1 recipient is expected. Moreover, the email is received by the recipient and duplicated with another email in which the SIEVE error is specified
Any help is appreciated.  
Below i added first lines from the error stack



09:23:37.239 [INFO ] o.a.j.s.SendMailHandler - Successfully spooled mail Mail1686464617103-df62f02b-fc93-45e0-901c-b5a206bc82af with messageId <65...@logika.ro> from test.user1@domain.com on 79.138.136.47/79.138.136.47 for [test.user1@domain.com, test.user2@domain.com]
09:23:37.239 [DEBUG] o.a.j.s.DataLineJamesMessageHookHandler - executing hook org.apache.james.protocols.smtp.core.log.HookResultLogger@5f33b30e
09:23:37.239 [DEBUG] o.a.j.p.s.c.l.HookResultLogger - org.apache.james.smtpserver.SendMailHandler: result= (OK CONNECTED)
09:23:37.239 [DEBUG] o.a.j.s.DataLineJamesMessageHookHandler - executing hook org.apache.james.smtpserver.jmx.HookResultJMXMonitor@571441c2
09:23:37.248 [DEBUG] o.a.j.m.i.JamesMailSpooler - ==== Begin processing mail Mail1686464617103-df62f02b-fc93-45e0-901c-b5a206bc82af ====
09:23:37.249 [DEBUG] o.a.j.m.l.AbstractStateCompositeProcessor - Call MailProcessor root
09:23:37.258 [DEBUG] o.a.j.m.l.AbstractStateCompositeProcessor - Call MailProcessor transport
09:23:37.283 [DEBUG] o.a.j.m.l.AbstractStateCompositeProcessor - Call MailProcessor local-delivery
09:23:37.289 [DEBUG] o.a.j.i.d.m.DefaultImapDecoder - Got <tag>: Tag{value=87.241}
09:23:37.289 [DEBUG] o.a.j.i.d.m.DefaultImapDecoder - Got <command>: SELECT
09:23:37.306 [DEBUG] o.a.j.m.c.GhostMailbox - Read mailbox succeeded
09:23:37.308 [DEBUG] o.a.j.m.s.StoreMailboxManager - Loaded mailbox #private:test.user1@domain.com:Sent Messages
09:23:37.314 [DEBUG] o.a.j.t.m.j.d.SieveExecutor - Evaluating org.apache.james.transport.mailets.jsieve.SieveMailAdapter Envelope From: test.user1@domain.com Envelope To: test.user1@domain.com Message ID: <65...@logika.ro> against "<te...@domain.com>"
09:23:37.339 [INFO ] o.a.j.t.m.j.SieveMailAdapter - Executing action: Action: org.apache.jsieve.mail.ActionKeep
09:23:37.340 [ERROR] o.a.j.SieveFactory - Evaluation failed.
javax.mail.MessagingException: Invalid number of recipients - 2. Exactly 1 recipient is expected.
    at org.apache.james.transport.mailets.jsieve.ActionUtils.getSoleRecipient(ActionUtils.java:52)
    at org.apache.james.transport.mailets.jsieve.FileIntoAction.execute(FileIntoAction.java:76)
    at org.apache.james.transport.mailets.jsieve.KeepAction.execute(KeepAction.java:63)
    at org.apache.james.transport.mailets.jsieve.KeepAction.execute(KeepAction.java:42)
    at org.apache.james.transport.mailets.jsieve.ActionDispatcher.execute(ActionDispatcher.java:70)
    at org.apache.james.transport.mailets.jsieve.SieveMailAdapter.executeActions(SieveMailAdapter.java:160)
    ... 97 common frames omitted
Wrapped by: org.apache.jsieve.exception.SieveException: javax.mail.MessagingException: Invalid number of recipients - 2. Exactly 1 recipient is expected.
    at org.apache.james.transport.mailets.jsieve.SieveMailAdapter.executeActions(SieveMailAdapter.java:162)
    at org.apache.jsieve.SieveFactory.evaluate(SieveFactory.java:165)
    at org.apache.james.transport.mailets.jsieve.delivery.SieveExecutor.sieveMessageEvaluate(SieveExecutor.java:138)
    at org.apache.james.transport.mailets.jsieve.delivery.SieveExecutor.sieveMessage(SieveExecutor.java:118)
    at org.apache.james.transport.mailets.jsieve.delivery.SieveExecutor.execute(SieveExecutor.java:112)
    at org.apache.james.transport.mailets.Sieve.service(Sieve.java:71)
    at org.apache.james.mailetcontainer.impl.ProcessorImpl.process(ProcessorImpl.java:81)
    at com.github.fge.lambdas.consumers.ConsumerChainer.lambda$sneakyThrow$9(ConsumerChainer.java:73) 
---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: Sieve mailet error

Posted by Benoit TELLIER <bt...@apache.org>.
Hello Mihai,

My bet is that you are among the first user to use the Sieve mailet...

I succeeded to reproduce the behaviour you describe in unit tests, and 
fixed it.

Here are the Jira tickets: 
https://issues.apache.org/jira/browse/JAMES-3913 
https://issues.apache.org/jira/browse/JAMES-3914

Here is the github PR: https://github.com/apache/james-project/pull/1589

Many thanks for the report.

This will be part of James release 3.8.1.

Regards,

Benoit

On 11/06/2023 14:00, Mihai Zamfira wrote:
> Hi,
> im using a james 3.8  with cassandra and opensearch.
>
> my “local-delivery” processor configuration looks like below .
>
> <processor state="local-delivery" enableJmx="true">
>              <mailet match="All" class="VacationMailet">
>                  <onMailetException>ignore</onMailetException>
>              </mailet>
>              <mailet match="All" class="Sieve">
>                  <onMailetException>ignore</onMailetException>
>              </mailet>
>              <mailet match="All" class="AddDeliveredToHeader"/>
>              <mailet match="All" class="org.apache.james.jmap.mailet.filter.JMAPFiltering">
>                  <onMailetException>ignore</onMailetException>
>              </mailet>
>              <mailet match="All" class="LocalDelivery"/>
> </processor>
>
> The problem appears when an email with 2 or more local recipients it’s received and Sieve it throw the following error "Invalid number of recipients - 2. Exactly 1 recipient is expected. Moreover, the email is received by the recipient and duplicated with another email in which the SIEVE error is specified
> Any help is appreciated.
> Below i added first lines from the error stack
>
>
>
> 09:23:37.239 [INFO ] o.a.j.s.SendMailHandler - Successfully spooled mail Mail1686464617103-df62f02b-fc93-45e0-901c-b5a206bc82af with messageId <65...@logika.ro> from test.user1@domain.com on 79.138.136.47/79.138.136.47 for [test.user1@domain.com, test.user2@domain.com]
> 09:23:37.239 [DEBUG] o.a.j.s.DataLineJamesMessageHookHandler - executing hook org.apache.james.protocols.smtp.core.log.HookResultLogger@5f33b30e
> 09:23:37.239 [DEBUG] o.a.j.p.s.c.l.HookResultLogger - org.apache.james.smtpserver.SendMailHandler: result= (OK CONNECTED)
> 09:23:37.239 [DEBUG] o.a.j.s.DataLineJamesMessageHookHandler - executing hook org.apache.james.smtpserver.jmx.HookResultJMXMonitor@571441c2
> 09:23:37.248 [DEBUG] o.a.j.m.i.JamesMailSpooler - ==== Begin processing mail Mail1686464617103-df62f02b-fc93-45e0-901c-b5a206bc82af ====
> 09:23:37.249 [DEBUG] o.a.j.m.l.AbstractStateCompositeProcessor - Call MailProcessor root
> 09:23:37.258 [DEBUG] o.a.j.m.l.AbstractStateCompositeProcessor - Call MailProcessor transport
> 09:23:37.283 [DEBUG] o.a.j.m.l.AbstractStateCompositeProcessor - Call MailProcessor local-delivery
> 09:23:37.289 [DEBUG] o.a.j.i.d.m.DefaultImapDecoder - Got <tag>: Tag{value=87.241}
> 09:23:37.289 [DEBUG] o.a.j.i.d.m.DefaultImapDecoder - Got <command>: SELECT
> 09:23:37.306 [DEBUG] o.a.j.m.c.GhostMailbox - Read mailbox succeeded
> 09:23:37.308 [DEBUG] o.a.j.m.s.StoreMailboxManager - Loaded mailbox #private:test.user1@domain.com:Sent Messages
> 09:23:37.314 [DEBUG] o.a.j.t.m.j.d.SieveExecutor - Evaluating org.apache.james.transport.mailets.jsieve.SieveMailAdapter Envelope From: test.user1@domain.com Envelope To: test.user1@domain.com Message ID: <65...@logika.ro> against "<te...@domain.com>"
> 09:23:37.339 [INFO ] o.a.j.t.m.j.SieveMailAdapter - Executing action: Action: org.apache.jsieve.mail.ActionKeep
> 09:23:37.340 [ERROR] o.a.j.SieveFactory - Evaluation failed.
> javax.mail.MessagingException: Invalid number of recipients - 2. Exactly 1 recipient is expected.
>      at org.apache.james.transport.mailets.jsieve.ActionUtils.getSoleRecipient(ActionUtils.java:52)
>      at org.apache.james.transport.mailets.jsieve.FileIntoAction.execute(FileIntoAction.java:76)
>      at org.apache.james.transport.mailets.jsieve.KeepAction.execute(KeepAction.java:63)
>      at org.apache.james.transport.mailets.jsieve.KeepAction.execute(KeepAction.java:42)
>      at org.apache.james.transport.mailets.jsieve.ActionDispatcher.execute(ActionDispatcher.java:70)
>      at org.apache.james.transport.mailets.jsieve.SieveMailAdapter.executeActions(SieveMailAdapter.java:160)
>      ... 97 common frames omitted
> Wrapped by: org.apache.jsieve.exception.SieveException: javax.mail.MessagingException: Invalid number of recipients - 2. Exactly 1 recipient is expected.
>      at org.apache.james.transport.mailets.jsieve.SieveMailAdapter.executeActions(SieveMailAdapter.java:162)
>      at org.apache.jsieve.SieveFactory.evaluate(SieveFactory.java:165)
>      at org.apache.james.transport.mailets.jsieve.delivery.SieveExecutor.sieveMessageEvaluate(SieveExecutor.java:138)
>      at org.apache.james.transport.mailets.jsieve.delivery.SieveExecutor.sieveMessage(SieveExecutor.java:118)
>      at org.apache.james.transport.mailets.jsieve.delivery.SieveExecutor.execute(SieveExecutor.java:112)
>      at org.apache.james.transport.mailets.Sieve.service(Sieve.java:71)
>      at org.apache.james.mailetcontainer.impl.ProcessorImpl.process(ProcessorImpl.java:81)
>      at com.github.fge.lambdas.consumers.ConsumerChainer.lambda$sneakyThrow$9(ConsumerChainer.java:73)
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org