dovecot 2.2.15 script_after not executed

Stephan Bosch stephan at rename-it.nl
Sun Feb 15 23:01:07 UTC 2015


On 2/12/2015 2:12 AM, Florin Portase wrote:
>
> On 2015-02-12 01:01, Stephan Bosch wrote:
>
>> On 2/11/2015 10:37 PM, Portase Florin wrote:
>>> On 2/11/2015 8:41 PM, Stephan Bosch wrote:
>>>> On 2/11/2015 7:34 PM, Florin Portase wrote:
>>>>> Hello  guys,
>>>>>
>>>>> I'm having troubles making "script_after" to exec sieve scripts::
>>>>>
>>>> Keep in mind that the sieve_after script is only executed when the
>>>> "keep" action [1 <https://tools.ietf.org/html/rfc5228#section-4.3>]
>>>> is executed or when the implicit "keep" [2
>>>> <https://tools.ietf.org/html/rfc5228#section-2.10.2>] is still
>>>> active, meaning that the user didn't give the mail an explicit
>>>> destination.
>>>>
>>>> If the user does perform actions like fileinto or redirect without a
>>>> `:copy' argument [3 <https://tools.ietf.org/html/rfc3894>] and
>>>> without performing an explicit "keep" [2
>>>> <https://tools.ietf.org/html/rfc5228#section-2.10.2>]
>>>> anywhere, the subsequent sieve_after scripts are not executed [4
>>>> <http://tools.ietf.org/html/draft-degener-sieve-multiscript-00>].
>>>>
>>>> Therefore sieve_after is only useful to provide default behavior for
>>>> when the user has no explicit rule for what should happen to the
>>>> e-mail.
>>>>
>>>>> `/home/vpopmail/domains/medianetork.ro/portase.florin/Maildir/sieve/dovecot1.sieve;name=lters'
>>>>> Feb 11 19:16:10 lda(portase.florin at medianetork.ro
>>>>> <mailto:portase.florin at medianetork.ro>): Info: sieve:
>>>>> msgid=AAa=MneAO6+wwLh3M8nz1z6Mi2Ae2aDMdrSakJA_-PYCwCvbCA at mail.gmail.com
>>>>> <mailto:msgid=AAa=MneAO6+wwLh3M8nz1z6Mi2Ae2aDMdrSakJA_-PYCwCvbCA at mail.gmail.com>>:
>>>>> stored mail into mailbox 'INBOX.Gmail'
>>>> This was probably done using a `fileinto "INBOX.Gmail";' command. This
>>>> cancels the implicit keep.
>>>>
>>>> To force executing sieve_after, the user needs to add a `:copy'
>>>> argument
>>>> to that fileinto command or a `keep;' action should be executed.
>>>>
>>>> Administrator policies that always need to  be executed must be placed
>>>> in a sieve_before script.
>>>>
>>>> For more information:
>>>>
>>>> [1]: https://tools.ietf.org/html/rfc5228#section-4.3
>>>> [2]: https://tools.ietf.org/html/rfc5228#section-2.10.2
>>>> [3]: https://tools.ietf.org/html/rfc3894
>>>> [4]: http://tools.ietf.org/html/draft-degener-sieve-multiscript-00
>>>>
>>>> Regards,
>>>>
>>>> Stephan.
>>>>
>>> Thanks Stephan,
>>>
>>> However still have one small issue:
>>>
>>> fileter.sieve
>>> ==========
>>>
>>> # rule:[amavis]
>>> if anyof (address :contains "From" "amavis",
>>>         address :contains "Cc" "amavis-users at amavis.org
>>> <mailto:amavis-users at amavis.org>",
>>>         address :contains "To" "amavis-users at amavis.org
>>> <mailto:amavis-users at amavis.org>")
>>> {
>>>         fileinto "INBOX.lists.amavisd-new";
>>> }
>>> # rule:[xxx_gmail]
>>> elsif anyof (header :contains "From" "xxx at gmail <mailto:xxx at gmail>")
>>> {
>>>         setflag "\\Flagged";
>>>         fileinto "INBOX.Gmail";
>>>         keep;
>>> }
>>>
>>> In this case, both all 3 sieve are executed: global one + filters +
>>> vacation.
>>> But as side note: when mail come from gmail account,
>>> - 1st     message is sent to inbox.gmail
>>> - 2nd     vacation response is sent
>>> -3rd    message is copied once more directly into INBOX
>>>
>>> Now, if I modify:
>>>         fileinto :copy INBOX.Gmail;
>>>
>>> The message is sent to INBOX.Gmail and also copied to INBOX
>>>
>>> How can I avoid such behavior  ?
>>

With your configuration, the vacation script is responsible for the
final delivery decision. If that script only executes the vacation
command, the message is stored into INBOX by default (implicit keep).

>> Why do you have the vacation script in a sieve_after rule?
>>  
>
> I'm using roundcube with 2 plugins ( sieverules + vacation_sieve)
>
> 1st one used to create filters for incoming messages and 2nd one just 
> "out of office" response.
>
> Because of the limitation of sieverules plugin related to definition
> of "out of office" response  I'm using 2nd one.
>
> So, I will have 2 .sieve files ( filters.sieve + vacation.sieve)
>
> Just to resume, when I'm activating vacation, the incoming message
> will be moved/copied to designated folder and vacation will be
> triggered after.
>
> As you can see here ::  dovecot1.sieve -> filters.sieve
>
> vacation plugin has a build-in function to activate itself as a
> _default_ rule.
>
> But as I mentioned before, incoming messaged will be filtered by
> filter.sieve and after ( if activated ) to trigger vacation response.
>
> Hope, i wasn't to ambiguous :)
>

If you want to force execution of the vacation rule, it should be in
sieve_before (or in you case that would be sieve_before2).

As a bonus, the user's main active script (filters.sieve) will have
responsibility for the final delivery. So if there's no (implicit) keep,
there will be no message in INBOX.

Regards,

Stephan.





More information about the dovecot mailing list