I'm wondering what I'd need to do to get the "important" flag set on an incoming message according to a pre-specified header.
I know the problem of this not being a "joined-up" feature in standard email, but in practice many MUAs set headers like X-priority etc, and IMAP has an "important" flag that is the obvious mapping.
I'm not really sure where would be the best place to try to put something like this. Should it be the delivery agent (qmail in my case), the IMAP server (i.e. Dovecot), or the MUA? To me the MUA doesn't make sense, as the flag should be set before any specific MUA even gets to the message.
Since the flags are coded into the filenames when using maildir, is it possible for qmail to deliver a message with the flag included in the filename, and will Dovecot recognise it? If so I might try hacking qmail.
Or any other ideas - has anyone else tried this?
-- Rick Jones
----- Original Message ----- From: "Rick Jones" <rick@activeservice.co.uk> To: <dovecot@dovecot.org> Sent: Friday, May 21, 2004 9:08 AM Subject: [Dovecot] "important" flag
I'm wondering what I'd need to do to get the "important" flag set on an incoming message according to a pre-specified header.
I know the problem of this not being a "joined-up" feature in standard email, but in practice many MUAs set headers like X-priority etc, and IMAP has an "important" flag that is the obvious mapping.
I'm not really sure where would be the best place to try to put something like this. Should it be the delivery agent (qmail in my case), the IMAP server (i.e. Dovecot), or the MUA? To me the MUA doesn't make sense, as the flag should be set before any specific MUA even gets to the message.
Since the flags are coded into the filenames when using maildir, is it possible for qmail to deliver a message with the flag included in the filename, and will Dovecot recognise it? If so I might try hacking qmail.
Or any other ideas - has anyone else tried this?
Probably in procmail, not in dovecot.
--On 21 May 2004 10:43 -0400 Nico Kadel-Garcia <nkadel@merl.com> wrote:
From: "Rick Jones" <rick@activeservice.co.uk>
I'm wondering what I'd need to do to get the "important" flag set on an incoming message according to a pre-specified header.
...
Since the flags are coded into the filenames when using maildir, is it possible for qmail to deliver a message with the flag included in the filename, and will Dovecot recognise it? If so I might try hacking qmail.
Probably in procmail, not in dovecot.
Interesting thought, but can procmail change the name of the delivered file? I didn't think it could, and AFAICS that's what needs to happen.
This is probably a bit OT now for Dovecot :)
-- Cheers Rick
On Fri, 2004-05-21 at 16:08, Rick Jones wrote:
I'm wondering what I'd need to do to get the "important" flag set on an incoming message according to a pre-specified header.
I know the problem of this not being a "joined-up" feature in standard email, but in practice many MUAs set headers like X-priority etc, and IMAP has an "important" flag that is the obvious mapping.
I'm not really sure where would be the best place to try to put something like this. Should it be the delivery agent (qmail in my case), the IMAP server (i.e. Dovecot), or the MUA? To me the MUA doesn't make sense, as the flag should be set before any specific MUA even gets to the message.
LDA is the correct place. Dovecot LDA with Sieve support would make this easy. Any voluenteers to write this? :) Shouldn't be too difficult using libsieve.
Since the flags are coded into the filenames when using maildir, is it possible for qmail to deliver a message with the flag included in the filename, and will Dovecot recognise it? If so I might try hacking qmail.
If the flag is in Dovecot's .customflags file you can hack qmail to directly add the flag in the filename. Files in new/ directory shouldn't actually contain flags (Dovecot's COPY works wrong here..), but Dovecot supports them fine.
--On 22 May 2004 05:47 +0300 Timo Sirainen <tss@iki.fi> wrote:
On Fri, 2004-05-21 at 16:08, Rick Jones wrote:
I'm wondering what I'd need to do to get the "important" flag set on an incoming message according to a pre-specified header. ... Since the flags are coded into the filenames when using maildir, is it possible for qmail to deliver a message with the flag included in the filename, and will Dovecot recognise it? If so I might try hacking qmail.
If the flag is in Dovecot's .customflags file you can hack qmail to directly add the flag in the filename. Files in new/ directory shouldn't actually contain flags (Dovecot's COPY works wrong here..), but Dovecot supports them fine.
I don't quite follow the significance of .customflags here, as the flag in question (important) isn't a custom one.
And are you saying that adding a flag to the file in new/ only works because Dovecot doesn't actually do the right thing? :) In which case, is this likely to be fixed/broken (depending on your viewpoint) in future?
Rick
On 22.5.2004, at 13:05, Rick Jones wrote:
If the flag is in Dovecot's .customflags file you can hack qmail to directly add the flag in the filename. Files in new/ directory shouldn't actually contain flags (Dovecot's COPY works wrong here..), but Dovecot supports them fine.
I don't quite follow the significance of .customflags here, as the flag in question (important) isn't a custom one.
What were you going to use then? Neither IMAP nor Maildir defines an "important" flag unless you use some existing one for it (flagged?). So I was thinking you'd add eg. "1 important" to .customflags and then use 'a' flag in maildir filename.
And are you saying that adding a flag to the file in new/ only works because Dovecot doesn't actually do the right thing? :) In which case, is this likely to be fixed/broken (depending on your viewpoint) in future?
I don't think I'm going to change the Dovecot's behaviour of accepting flags in new/ dir, but I was going to change COPY command to move files directly into cur/ to avoid problems with other maildir clients.
I think with Sieve LDA it would work also by storing the mail directly into cur/ directory.
--On 22 May 2004 17:07 +0300 Timo Sirainen <tss@iki.fi> wrote:
On 22.5.2004, at 13:05, Rick Jones wrote:
I don't quite follow the significance of .customflags here, as the flag in question (important) isn't a custom one.
What were you going to use then? Neither IMAP nor Maildir defines an "important" flag unless you use some existing one for it (flagged?). So I was thinking you'd add eg. "1 important" to .customflags and then use 'a' flag in maildir filename.
OK, I think maybe I've got some terminology confused. My IMAP client (Mulberry) offers "important" as one of the standard flags, as well as supporting custom ones. I guess the official IMAP definition of this is simply "flagged". In any event, that's the one I want to use.
I don't think I'm going to change the Dovecot's behaviour of accepting flags in new/ dir
Sounds good :)
but I was going to change COPY command to move files directly into cur/ to avoid problems with other maildir clients.
I see, so that applies only when the client invokes a COPY between folders?
I think with Sieve LDA it would work also by storing the mail directly into cur/ directory.
Seems to make sense - think I need to learn more about Sieve :-/
-- Cheers Rick
On Sat, 2004-05-22 at 18:45, Rick Jones wrote:
but I was going to change COPY command to move files directly into cur/ to avoid problems with other maildir clients.
I see, so that applies only when the client invokes a COPY between folders?
Well, APPEND command also accepts initial message flags so that'd have to be changed too.
Hmm.. Currently Dovecot sets the \Recent flag by checking if mail is in new/ directory. I guess I'll have to do some changes to also set \Recent if it's in cur/ but isn't in dovecot-uidlist file..
I think with Sieve LDA it would work also by storing the mail directly into cur/ directory.
Seems to make sense - think I need to learn more about Sieve :-/
Sieve looks nice enough language for mail filtering. Now if I only could get Dovecot to support it :)
Hi Timo
--On 23 May 2004 04:58 +0300 Timo Sirainen <tss@iki.fi> wrote:
Hmm.. Currently Dovecot sets the \Recent flag by checking if mail is in new/ directory. I guess I'll have to do some changes to also set \Recent if it's in cur/ but isn't in dovecot-uidlist file..
But would that be right? If I copy an old (not-recent) message into another mailbox, I'm not sure I want it flagged 'recent' in its new location. I'd prefer the 'recent' state to be like any other flag, and be preserved with the message - either on or off.
I think with Sieve LDA it would work also by storing the mail directly into cur/ directory.
Seems to make sense - think I need to learn more about Sieve :-/
Sieve looks nice enough language for mail filtering. Now if I only could get Dovecot to support it :)
You pre-empted my next question! I was half-expecting Sieve to be available as a separate server, but it looks like it needs to be integrated into the IMAP server. It's clearly the way Cyrus does it. Any plans?
-- Cheers Rick
On 23.5.2004, at 12:19, Rick Jones wrote:
Hmm.. Currently Dovecot sets the \Recent flag by checking if mail is in new/ directory. I guess I'll have to do some changes to also set \Recent if it's in cur/ but isn't in dovecot-uidlist file..
But would that be right? If I copy an old (not-recent) message into another mailbox, I'm not sure I want it flagged 'recent' in its new location. I'd prefer the 'recent' state to be like any other flag, and be preserved with the message - either on or off.
\Recent flags are a bit useless for human purposes anyway if you're using multiple IMAP clients concurrently to access the mailbox. Only one of the sessions sees the message as recent. So it's mostly useful for things like client-side filtering or other message processing. For that purpose I think it's better to set the \Recent flag again while copying the message. Besides, that's what RFC requires and I'd do anyway :)
I've however thought about \Recent-like flag which works nicer with multiple sessions. For that the flag might be better if it \Recent wasn't set when copying. Hmm. I can't find that message in web archives anymore, here: http://dovecot.org/tmp/recent.txt
Maybe call it \New or something :)
You pre-empted my next question! I was half-expecting Sieve to be available as a separate server, but it looks like it needs to be integrated into the IMAP server. It's clearly the way Cyrus does it. Any plans?
It doesn't really need to be integrated with IMAP, but it does need to know where the mailboxes are stored and in which format. So using Dovecot's mailbox library it should be easier than creating a completely separate thing. It's planned, but I'm not sure when exactly I'll implement it.
You could also try Mark Mallet's http://www.mvmf.org/test/ which I heard provides Sieve support but I still haven't looked at that myself.. :)
On Sun, May 23, 2004 at 04:11:28PM +0300, Timo Sirainen wrote:
On 23.5.2004, at 12:19, Rick Jones wrote:
You pre-empted my next question! I was half-expecting Sieve to be available as a separate server, but it looks like it needs to be integrated into the IMAP server. It's clearly the way Cyrus does it. Any plans?
It doesn't really need to be integrated with IMAP, but it does need to know where the mailboxes are stored and in which format. So using Dovecot's mailbox library it should be easier than creating a completely separate thing. It's planned, but I'm not sure when exactly I'll implement it.
Probably time to mention again the notion of having some kind of redelivery when moving from one folder to another. i.e. for a folder so configured, instead of the IMAP/POP server writing a message directly into the folder, it would invoke a delivery agent to do so. This would be great for giving new filter rules a new crack at an old message, or for things like adding to a statistical spam corpus, etc.
You could also try Mark Mallet's http://www.mvmf.org/test/ which I heard provides Sieve support but I still haven't looked at that myself.. :)
Just start at www.mvmf.org though, the /test/ was an old thing.
Relatedly, Matthew Elvey has a matrix of SIEVE implementations at:
http://wiki.fastmail.fm/wiki/index.php/SieveExtensionsSupportMatrix
It's an alpha version but it seems like a good thing to have.
-mm-
On 23.5.2004, at 22:55, Mark E. Mallett wrote:
Probably time to mention again the notion of having some kind of redelivery when moving from one folder to another. i.e. for a folder so configured, instead of the IMAP/POP server writing a message directly into the folder, it would invoke a delivery agent to do so. This would be great for giving new filter rules a new crack at an old message, or for things like adding to a statistical spam corpus, etc.
I think this is a plugin's job, and it shouldn't be very difficult to implement for 1.0-tests. Just override the mailbox_save() function in mail-storage. Or possibly create entirely new namespace for it, hmm..
You could also try Mark Mallet's http://www.mvmf.org/test/ which I heard provides Sieve support but I still haven't looked at that myself.. :)
Just start at www.mvmf.org though, the /test/ was an old thing.
Well, I finally looked at it. So it's more than just Sieve, I thought you had just used libsieve to do it. Once Dovecot 1.0's mail-storage API stabilizes would be nice if mvmf could use it directly :)
participants (4)
-
Mark E. Mallett
-
Nico Kadel-Garcia
-
Rick Jones
-
Timo Sirainen