UPDATE (2 sept 2014 13:01): Just to clarify, I'm interested in handling an incoming reply from someone else, so coming in via SMTP. If it is a reply to an email that is already in some mail folder, it should be stored in that folder too.
I have a Postfix (SMTP) + Dovecot (IMAP) setup, with my /home/sybren/Maildir directory storing my mail. I have a Sieve filter to ensure my work email ends up in the "work" IMAP folder. My IMAP folder structure is quite extensive, with several sub-folders, say work/research/subject1
, work/research/subject2
, work/education/subject3
, etc.
As an example, let's say I send an email to my colleagues with the subject "AAAAAA". After sending it, I move it into the folder work/research/subject1
. Now I would like their replies "Re: AAAAAA" to be stored in work/research/subject1
too, by Dovecot.
Email is handed over from Postfix to Dovecot using this setting in main.cf (all on one line)
mailbox_command = /usr/lib/dovecot/deliver -c
/etc/dovecot/dovecot.conf -m "${EXTENSION}"
My main.sieve file now contains simple rules like:
require ["fileinto"];
if header :contains ["To", "Cc", "Bcc", "From"] "@work.nl" {
fileinto "work";
}
UPDATE 2 (2 sept 2014 15:16): This is the "flow" that I would like to see for an incoming email:
- Postfix receives the email via SMTP.
- Postfix performs spam/virus scanning.
- Postfix hands the mail over to Dovecot for delivery.
- Dovecot inspects some database of message ID to mail folder mappings.
- If the In-Reply-To message ID is found, deliver to the corresponding mail folder.
- If not, use the Sieve script to determine the appropriate location.
Of course, the last two steps could theoretically be part of the same Sieve script.
I hope someone can help me out!
Cheers,
Sybren