Blog's control panel: | Home | Tags | Index | Rss 2.0

Mark email as read with procmail and maildir

Sat, 07 Jul 2007 | Permalink | Tags: ,

I am subscribed to several mailing lists but dont actually read a couple of them, yet I like the idea of archiving them for future reference. But seeing those mailboxes in the list of those with new messages distract my eye, so I looked for a way to mark those messages as read immediately after downloading them.
I run procmail, which is powerful enough to require only a few config lines to accomplish the task. Being maildir it's not as immediate as adding a "Status: RO" header, and a call to mv is necessary, but overall it's elegant enough. Here it comes:

:0
* conditions
{
  foldername=whatever

  :0c
  .$foldername/ # stores in .$foldername/new/

  :0
  * LASTFOLDER ?? /\/[^/]+$
  { tail=$MATCH }

  TRAP="mv $LASTFOLDER .$foldername/cur/$tail:2,S"

  HOST
}
This was taken straight from the procmail mailing list




SpikeLab.org is a Filippo Spike Morelli copyright 2005-2008
This work is licensed under Creative Commons Att-SA License.