[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Debian-* & procmail recipe



Pollywog wrote:

>I have tried to get procmail to start from my exim .forward file, but it
>does not work.  I instead went to sortmail, which starts from my Exim
>.forward file, but it does not do fancy stuff like what you mentioned in
>your post.
>
>The reason I tried sortmail is that it is written in C and
>it should run faster than Exim scripts.

I personally don't see the point in having an unnecessary step with the
process of mail delivery. I also get rid of problems with domain set up
with Exim (no, not the :localhost thing). So, fetchmail just calls
procmail directly:

poll "mail.globalnet.co.uk" protocol POP3 username "dufas" password
"mypass" mda "procmail -d smaug" options fetchall

That's all one line, and I use it with an account where mail can be
addressed to XYZ@loginname.globalnet.co.uk, or any other value for XYZ,
including loginname@globalnet.co.uk.

Ultra-basic .procmailrc which will put mail into a single mailbox (set
with the "DEFAULT:" part):

-- Start ---
PATH=/usr/bin:/bin:/usr/local/bin:/home/smaug/bin
MAILDIR=/home/smaug/mail
LOGFILE=/home/smaug/mail/.log/procmail.log
VERBOSE=ON
LOGABSTRACT=all
SHELL=/bin/sh
TMPDIR=/tmp
DEFAULT=/home/smaug/mail/inbox
--- End ---

I sort my mail into mailboxes like ~/mail/lists/debian-user/1999-08 so
no single mbox can get too large. Handy for getting rid of old mail,
too.

Simple delivery recipe for new users, so they don't have to figure it
out from the many examples:

--- Start ---
# Freshmeat
:0:
* ^From.*@freshmeat.net
/home/smaug/mail/lists/freshmeat/${MONTHSTRING}
--- End ---

I have ${MONTHSTRING} set with "MONTHSTRING=`date +%Y-%m`" right at the
top of my procmailrc. (Note: It would be "^From:.*", but apparently the
From: header might not have the colon (it's an RFC thing)).

And lets throw in another couple just for the sake of it. Maybe I'll add
a header to certain posts or something so that my .sig is changed to
"Campaign For Proper Sig Delimiters" when I reply to various posts...

# Correct wrong sig-dashes
:0 fBw
* ^--$
| sed -e 's/^--$/-- /'

# Put any duplicate message into 'duplicates' mbox
:0Whc:.msgid.lock
| formail -D 8192 .msgid.cache
 :0a:
  /home/smaug/mail/duplicates

# Add [Kris] to the subject if the body contains my name
:0 fBw
* (\<Kris\>|\<Kris Clarke\>)
| sed -e 's/^\(Subject: .*\)\[Kris\] /\1/' \
      -e 's/Re: Re: /Re: /'                \
      -e 's/^Subject: \(.*\)/Subject: [Kris] \1/'

# Correct OE stupidness; could add "AW:" too
:0 fHw
* ^Subject:.*SV:
| sed -e 's/SV:/Re:/g'

# Remove various headers from debian-{all of them} list
:0 fhw
* ^X-Mailing-List:.*debian
| formail -I Resent-Message-ID:  \
          -I Resent-From:        \
          -I X-Envelope-From:    \
          -I X-Accept-Language:  \
          -I X-Envelope-Sender:  \
          -I Resent-Cc:          \
          -I Resent-Date:        \
          -I Resent-Sender:      \
          -I Received:           \
          -I X-Loop:             \
          -I Precedence:         \
          -I Sender:             \
          -I X-Envelope-To:

# Record message-ID log. To only record non-mailing list
# messages, put this after all mailing list delivery recipes.
YEAR=`date +%Y`
MONTH=`date +%m`
DAY=`date +%d`
HOURS=`date +%H`
MINUTES=`date +%M`
SECONDS=`date +%S`

:0
* ^Message-Id: \/.*
{
    MESSAGEID = "$MATCH"
}

GZIPHERE=`echo -e \
"$MESSAGEID\t$YEAR-$MONTH-$DAY\t\t$HOURS:$MINUTES:$SECONDS" \
         | gzip >> /home/smaug/mail/.log/mail-$YEAR-$MONTH.gz`

Yes, I know that one's fork()-intensive, but it's perfectly fast enough
for me.

If anyone else has got any other nifty procmail bits & bats, then please
share them :-) That doesn't include the ones which are in the FAQs like
the PGP-compliant-mail-maker one :-)

Oh, and if anyone feels like taking a peek at a MIME filtering question
(not to do with procmail) at <37bd83b5.1929160@hellfire.org> on your
local news server (comp.mail.mime), then it would be very much
appreciated...

Ciao,
  Kris (currently swearing at his monitor because it died an hour ago)

-- 
Kris | sigma9@earthling.net


Reply to: