Subject: Update to Recipe to keep list of mail addresses

From: [email-masked] (Chris Osborn)
Date: Sat, 2 Oct 93 14:02:21 -0700

Here's an update to the recipe I'm using to maintain a list of all the
people that send me mail. It's mostly just some enhancements to the
sed script.

from .procmailrc:
########################################
# Make log of email addresses

:c: mailaddress.lock
!^FROM_DAEMON
|formail -c -x 'From:' | sed -f ~/lib/fix.mailaddr.sed >> ~/mailaddress ; sort -fdu -o ~/mailaddress ~/mailaddress

~/lib/fix.mailaddr.sed:
# Fixup white space
s/	/ /g
s/^  *//
s/  *$//
s/   */ /g
# Focus on mail address
s/> (\(.*\))$/> \1/
s/> "\(.*\)"$/> \1/
s/<\(.*\)> \(.*\)/\2 <\1>/
s/^\([^<>]*\) (\(.*\))$/\2 <\1>/
s/^\([^<>]*\) "\(.*\)"$/\2 <\1>/
s/^(\(.*\)) \([^<>]*\)$/\1 <\2>/
s/^"\(.*\)" \([^<>]*\)$/\1 <\2>/
s/^(\(.*\)) </\1 </
s/^"\(.*\)" </\1 </
s/^\([^ <][^ ]*\)$/<\1>/
# delete addresses with no real address
/[^>]$/d
# delete local addresses (I can look these up in /etc/passwd)
/<[^.!]*>/d
# convert commas because NeXT's stupid Mail.app can't handle them
# in its Addresses panel (~/.NeXT/.mailalias)
s/\([^ ]\),/\1 -/g
s/,/-/g
# Put last name first
s/^\([^-][^-]*\) \([^-][^-]*\) </\2 - \1 </
# Cleanup
# I don't use this, but I tossed it in to make it easier
# for someone else to change.
#s/\(.*\) <\(.*\)>/(\1) \2/
#s/<\(.*\)>/\1/

---
Chris Osborn, Network Administrator      Voice: 707 253 3130
Napa Valley College                        Fax: 707 253 3063
[email-masked]
[email-masked]              NeXTMail ok at both