recipient delimiter and sieve filters
Dear all,
I have found a way to automatically copy sent emails in the "Sent" folder, but I am not sure it is the simplest and more reliable way on the long term.
I am open to suggestions if I miss a feature in Dovecot - or Postfix, that allows me to do this. I vaguely remember an SMTP extension that do that, but my memory could be wrong.
First, I use "~" as a recipient delimiter. Then, I set up a postfix senders_bcc_map that add the ~Sent part:
andre@homebox.space → bcc: andre~Sent@homebox.space
It worked, except that the emails was marked as new.
I tried first to add a global sieve filter like this:
# Sieve script executed before for user require ["fileinto","imap4flags"];
# Move automatically copied emails to the sent folder # And mark them as read if header :contains "Delivered-To" "~Sent" { setflag "\\Seen"; fileinto "Sent"; }
But it did not work, so maybe there is a trick I am not aware of.
If I use the "Received" header and a regex, it works
require ["fileinto","imap4flags","regex"]; if header :regex "Received" "for <[a-z]+~Sent@homebox.space>;" { setflag "\\Seen"; fileinto "Sent"; }
This is working perfectly, but there is limitations, IMHO.
If the recipient delimiter is not compatible with a regex (e.g. "+"), then the script will probably fail.
Parsing every new email using a regular expression might not be the best option in term of system load.
So, I finally use this:
# Move automatically copied emails to the sent folder # And mark them as read require ["fileinto","imap4flags"]; if header :contains "Received" "~Sent" { setflag "\\Seen"; fileinto "Sent"; }
My question is why the first one does not work? Does the email has been moved to the Sent folder, and dovecot sieve plugin is not able to find the email any more?
Kind regards, André
Op 3/24/2018 om 9:16 AM schreef André Rodier:
Dear all,
I have found a way to automatically copy sent emails in the "Sent" folder, but I am not sure it is the simplest and more reliable way on the long term.
I am open to suggestions if I miss a feature in Dovecot - or Postfix, that allows me to do this. I vaguely remember an SMTP extension that do that, but my memory could be wrong.
I think you mean:
https://tools.ietf.org/html/rfc4468
Which was recently added to Dovecot as a feature:
https://wiki.dovecot.org/Submission
However, clients will not support this at this time, so you will not be helped there.
First, I use "~" as a recipient delimiter. Then, I set up a postfix senders_bcc_map that add the ~Sent part:
andre@homebox.space → bcc: andre~Sent@homebox.space
It worked, except that the emails was marked as new.
I tried first to add a global sieve filter like this:
# Sieve script executed before for user require ["fileinto","imap4flags"];
# Move automatically copied emails to the sent folder # And mark them as read if header :contains "Delivered-To" "~Sent" { setflag "\\Seen"; fileinto "Sent"; }
But it did not work, so maybe there is a trick I am not aware of.
The Delivered-To header is currently only added when there is a single recipient in the LMTP session. It would not surprise me when the ~Sent Bcc is batched in the same transaction by Postfix, which means that this header is never added.
You'd better use the envelope extension:
https://tools.ietf.org/html/rfc5228#section-5.4
Regards,
Stephan.
On 24/03/18 10:24, Stephan Bosch wrote:
Op 3/24/2018 om 9:16 AM schreef André Rodier:
Dear all,
I have found a way to automatically copy sent emails in the "Sent" folder, but I am not sure it is the simplest and more reliable way on the long term.
I am open to suggestions if I miss a feature in Dovecot - or Postfix, that allows me to do this. I vaguely remember an SMTP extension that do that, but my memory could be wrong.
I think you mean:
https://tools.ietf.org/html/rfc4468
Which was recently added to Dovecot as a feature:
https://wiki.dovecot.org/Submission
However, clients will not support this at this time, so you will not be helped there.
First, I use "~" as a recipient delimiter. Then, I set up a postfix senders_bcc_map that add the ~Sent part:
andre@homebox.space → bcc: andre~Sent@homebox.space
It worked, except that the emails was marked as new.
I tried first to add a global sieve filter like this:
# Sieve script executed before for user require ["fileinto","imap4flags"];
# Move automatically copied emails to the sent folder # And mark them as read if header :contains "Delivered-To" "~Sent" { setflag "\\Seen"; fileinto "Sent"; }
But it did not work, so maybe there is a trick I am not aware of.
The Delivered-To header is currently only added when there is a single recipient in the LMTP session. It would not surprise me when the ~Sent Bcc is batched in the same transaction by Postfix, which means that this header is never added.
You'd better use the envelope extension:
https://tools.ietf.org/html/rfc5228#section-5.4
Regards,
Stephan.
Thank you, Stephan.
Yes, the link was what I had in mind.
Kind regards, André
participants (2)
-
André Rodier
-
Stephan Bosch