Mail activated scripts

Matthew Hawkins matthew at
Mon Feb 11 10:36:18 EST 2002

On Sun, 10 Feb 2002, Rasjid Wilcox wrote:
> I then need to get KMail to check my 'local' account in 
> /var/spool/mail/username.  Do I use the Procmail lockfile 
> /var/spool/mail/username.lock in KMail??

No.  The lock file is there to prevent procmail from delivering to a
mailbox that it is currently screwing with in another process.  KMail
needs to read the real mailbox, /var/spool/mail/username just as normal.

Another thing you could do is, in the procmailrc, get procmail to write
its lockfiles elsewhere (eg, your home dir).  It doesn't matter where
the lockfile is provided that procmail can find it.  The reason I say
this is that it is possible to run into problems with the lock files in
the world-writable mail spool, problems like a corrupted spool.
Read the procmail doco on how to specify an alternate lock file location
to the rules.

> Once I've got all this working, then I read up about procmail and how to get 
> it to do things (like run a shell script on a certain type of mail trigger).

It uses the pipe (|) to execute external commands.  One common use is to
reinject mail with 'formail', you can use this to get rid of duplicate
email (by message-id header):

:0 Wh
| formail -D 12800 msgid.cache



More information about the linux mailing list