I realized that after further testing.
I managed to solve it, by adding the header in the appendfile transport for
the sent folder ("headers_add = Status: RO"), that is set by the
system_filter_file_transport directive, which now makes Dovecot think that
the email I put in the Sent folder is already read, so I don't get a
unneccesary "New email" notification inside my email client.
I knew that the "unseen save" did set up a further delivery, but what I
tought, was that "unseen save" would take a "snapshot" of the email as it
looks now, exit that "snapshot" from the filter, and then run it through
deliver, while the "rest of the email" would go through the rest of the
filter.
But apparently, the "unseen save"d email does continue execution in the
system filter.
-----Ursprungligt meddelande-----
Från: Ian Zimmerman via Exim-users <exim-users@???>
Skickat: den 7 maj 2020 18:17
Till: exim-users@???
Ämne: Re: [exim] How I do to add headers to a unseen save in a system
filter?
On 2020-05-07 07:27, Sebastian Nielsen wrote:
> I wonder, how I do to add headers to a unseen save in a system filter, but
> which is NOT sent through to the original recipient, just used for the
> unseen save?
>
> I tried with:
>
> if $received_port is 10026 then
> if $sender_address_domain is sebbe.eu then
> headers add "Status: RO"
> unseen save /var/mail/sebastian/Sent
> headers remove "Status"
> endif
> endif
>
> but didn't work.
This is because "save", "unseen" or not, doesn't save the message at
that point, but rather sets up an additional delivery to be done in the
normal Exim pipeline, ie. at the routing stage.
What I would do (and I think this is the officially approved way) is use
"add" to change one of the user variables, n0 through n9, as a way of
setting a flag; later, at the transport stage, you can test the flag by
expanding $sn0 (for example) and add the header at that time, if indicated.
--
Ian
--
## List details at
https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at
http://www.exim.org/
## Please use the Wiki with this list -
http://wiki.exim.org/