Mark As Read with maildrop

| 2 Comments | No TrackBacks

I run my own mail server using maildrop to deliver to multiple virtual LDAP users. My personal e-mail is sorted into many folders on the server as it comes in. To reduce my e-mail maintenance overhead, I decided to mark messages as read automatically in certain folders. This is useful for low-priority e-mails such as advertisements, coupons, etc.; I want to view these when I need them - not when I receive them.

It turns out that maildrop doesn't have any facilities built in to do this automatically. It does, however, provide you with the tools to roll your own:

cc "${MAILDIR}.offers/"
`for x in ls ${MAILDIR}/.offers/new/*; do mv $x ${MAILDIR}/.offers/cur/${x##*/}:2,S; done`
to "/dev/null"

Since the 'to' directive exits immediately after execution, you must cc then move. Delivering to /dev/null then stops execution of the filter.

No TrackBacks

TrackBack URL: http://blog.sigil.org/cgi-bin/mt/mt-tb.cgi/33

2 Comments

Actuall there is an error in your lines:

for x in ls ${MAILDIR}/.offers/new/*; do echo $i; done

retruns

ls
${MAILDIR}/.offers/new/1279055489.M94518P12432V0000000000000806I04898146_0.host,S=2497
${MAILDIR}/.offers/new/1279056426.M280984P17573V0000000000000806I04898147_0.host,S=5405

so you either meant

for x in $(ls $MAILDIR/.offers/new); do echo $i; done

or

for x in ${MAILDIR}/.offers/new/*; do echo $i; done


which brings us to

cc "${MAILDIR}.offers/"
`for x in $(ls $MAILDIR/.offers/new); do mv ${MAILDIR}/.offers/new/$x ${MAILDIR}/.offers/cur/$x:2,S; done`
to "/dev/null"

Andi,

I just double-checked the code I posted, and it is the same that has been working for me since this post. It looks like you missed the backticks that I wrapped the entire for-loop in. The code from my maildroprc needs to be modified to work on the command-line. This is maildrop 2.1.0, so the syntax may have changed.

Thanks,
Richard

Leave a comment