[imapfilter-devel] formail -a style message manipulation

Lefteris Chatzimparmpas lefcha at hellug.gr
Sat Jun 20 11:26:39 EEST 2009


Joe MacDonald wrote:
> [...]
> 
> I want to leave my mail in INBOX, but I'd like to condition it a bit
> based on what's in it.  I used to be able to do this with procmail and
> formail, where I could search on header fields or body contents and then
> add X-header: foo style header fields to a message in-place with
> 'formail -a'.  I've been trying to find a way to do this with imapfilter
> but the best I've come up with so far is to match on whatever I want to
> match on, use pipe_into() to feed it into formail locally, delete the
> old message off the server and the put the new message back to the
> server again.  Is this my only option?

Hello,

Hmm... Unfortunately there is no way to process messages residing on an
IMAP server (through some IMAP request), but what you might do is fetch
the message, delete it from the server, process it using Lua string
functions and then append it back to the server.  But this requires the
use of a low level hidden function that imapfilter has for appending
messages to an IMAP mailbox.  I would probably have to add a documented
command to make it easier ... I could do that if you think it would do
your job.

> I'm reluctant to do this because I found bad things would happen when I
> had imapfilter running as a daemon and shuffling messages into
> subfolders while mutt was open and looking at my mailbox.  Either
> imapfilter or mutt (or both) would segfault and die on me if I was in
> the midst of replying to a message (that is, updating the message flags)
> in mutt when imapfilter woke up and processed my mailboxes.

Yes, that's hairy.  What I suggest and what I would do in your case, is
use user keywords, if the server supports it.  With them you basically
add custom user defined flags to messages (instead of the 5 default IMAP
flags).  This way you can mark messages without limitations... at least
if marking is what you're after... If so, have a look in the PROCESSING
section of the imapfilter_config(5) man page...

> 
> -- 
> Joe MacDonald
> :wq
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Imapfilter-devel mailing list
> Imapfilter-devel at lists.hellug.gr
> http://lists.hellug.gr/mailman/listinfo/imapfilter-devel



More information about the Imapfilter-devel mailing list