Marking mails as read from maildrop script

1

I use a maildrop script to sort my mails directly on the mail server into folders and I would like it to mark certain unnecessary mails as read.

Unfortunately maildrop does not seem to have a command for that.

Right now I use this line to rename the newest mail of the qmail Maildir folder to a 2,s read status:

 `ls -t "$MAILDIR/.0 Spamfilter.catchall/new" | head -1 | xargs -I {} mv "$MAILDIR/.0 Spamfilter.catchall/new/{}" "$MAILDIR/.0 Spamfilter.catchall/cur/{}:2,S"`

However, this sometimes fails and the mail remains unread. I guess there is a race condition, when another mails arrives, before the mv has been executed.

BeniBela

Posted 2017-09-29T20:56:00.673

Reputation: 1 023

Have you tried to set FLAGS variable in maildropfilter? http://www.courier-mta.org/maildrop/maildropfilter.html

– AnFi – 2017-09-30T06:54:46.573

no, i did not rtfm, just followed a tutorial – BeniBela – 2017-09-30T11:08:33.400

Now I tried FLAGS="S" before to, but it does not seem to do anything – BeniBela – 2017-09-30T14:17:39.690

1Omg, on the server they have maildrop 2.5.5. FLAGS was added in maildrop 2.8.4 – BeniBela – 2017-09-30T18:55:36.827

Answers

0

This before the to does the thing:

  FLAGS="S"

However, the tricky part is to install >=2.8.4 on shared hosting without root rights. I did it like this: Download "courier-unicode-2.0.tar.bz2" and "maildrop-2.9.2.tar.bz2" from courier-mta.org:

cd courier-unicode-2.0/
./configure  --prefix=/home/user/
make
make install

cd ../maildrop-2.9.2
export CPPFLAGS=-I/home/user/include
export LDFLAGS=-L/home/user/lib/
./configure  --prefix=/home/user
make
make install

and then changed the .qmail files to |/home/user/bin/maildrop

BeniBela

Posted 2017-09-29T20:56:00.673

Reputation: 1 023