Hi all,
The user isomail fetchmails every 5 minutes
via my a2000.nl-cable-modem
the mailserver of xs4all.nl,
a more reliable mailserver than that of a2000.
All mailaddresses are xxx(_at_)isolution(_dot_)nl
which are aliases of rvtol(_at_)xs4all(_dot_)nl
Each message is scanned for
clues to find out for who
the message was ment to be.
Some messages need to go to
more than 1 person.
First, a copy of the raw message
is appended to a daily file.
In step 1/3 special headers are added
(at least an X-isomail-To: local-user-name).
In step 2/3 the message is distributed
to 1 or more local accounts,
and appended to a file per user per day.
(As you'll see, each block looks about the same,
does anyone know a looping construct to do the same,
because the number of users will grow?).
In step 3/3 the cooked message
is appended to a daily file.
It's all still quite experimental.
I think I will go move to
sendmail virtuser/alias/general etc.
later this week ...
See also Q3.29 of http://www.sendmail.org/faq
I have been hyper-correct in some places,
like the (<) and (>).
Please show your knowledge
in that area, for the benefit of us all.
Regards, "Dr." Ruud
Chaos rules
.procmailrc
# * * * * * * * * * * * * * * * * #
# ISOLUTION B.V. July 30, 1999 #
# * * * * * * * * * * * * * * * * #
#==============================
# Variables:
#------------------------------
SHELL=/bin/sh
DEFAULT=ruud(_at_)localhost
LOGFILE="/var/log/procmail.log"
LOGABSTRACT="all"
VERBOSE="on"
FORMAIL="/usr/bin/formail"
YYYYMMDD=`date +%Y%m%d`
ENV_TO=$1
XET="X-Envelope-To:"
XTO="X-isomail-To:"
XD1="X-isomail-Step1:"
ATME="@localhost"
MUSR="isomail"
MADM="postmaster"
BUDIR="./procmail/"
#====================================
# Append raw message to a local file
#------------------------------------
:0 c
$BUDIR$MUSR.$YYYYMMDD.raw
#============================
# Safety unlooper 1999.07.30
#----------------------------
:0
*$ ^$XTO
$BUDIR$MUSR.$YYYYMMDD.xto
#===========================================
# Add X-Envelope-To: -header
#-------------------------------------------
:0 fh w
* ENV_TO ?? .
| $FORMAIL -i "$XET $ENV_TO"
:0 E fh w
| $FORMAIL -i "$XET UNKNOWN"
#===========================================
# Auto-Reply to messages with Subject: ping
#-------------------------------------------
:0
*$ ! ^X-Loop: $MUSR(_at_)isolution\(_dot_)nl
* ^TO(postmaster|info|ping)@isolution\.nl
* ^Subject: ping$
{
:0 fh w
| $FORMAIL -rt -A"X-Loop: $MUSR(_at_)isolution(_dot_)nl"
:0 c # Record this ping request
| ( cat -; \
echo `uptime`; \
echo "$HOST User count: " `who | wc -l`; \
) | $SENDMAIL -t
:0 :
$BUDIR$MUSR.$YYYYMMDD.ping
}
#============================================
# Speed-up Macro
#--------------------------------------------
from_mailer = "!"
:0
* ^FROM_MAILER
{
from_mailer = "!!" # double !! means "OK"
}
#============================================================
# Step 1/3: create X-isomail-headers
#------------------------------------------------------------
:0 fh w
| $FORMAIL -A"$XD1 START"
LOCUSR=ruud
ADREXP=rvtol@(hacktic|xs4all|isolution)\.nl
:0 fh w
*$ ^TO()\/$ADREXP
| $FORMAIL -A"$XTO $LOCUSR ($MATCH)"
:0 E fh w
*$ ^Received: .*()\/for (<)$ADREXP(>)
| $FORMAIL -A"$XTO $LOCUSR ($MATCH)"
LOCUSR=mj
ADREXP=flo(_at_)isolution\(_dot_)nl
:0 fh w
*$ ^TO()\/$ADREXP
| $FORMAIL -A"$XTO $LOCUSR ($MATCH)"
:0 E fh w
*$ ^Received: .*()\/for (<)$ADREXP(>)
| $FORMAIL -A"$XTO $LOCUSR ($MATCH)"
LOCUSR=joke
ADREXP=jmeijer(_at_)isolution\(_dot_)nl
:0 fh w
*$ ^TO()\/$ADREXP
| $FORMAIL -A"$XTO $LOCUSR ($MATCH)"
:0 E fh w
*$ ^Received: .*()\/for (<)$ADREXP(>)
| $FORMAIL -A"$XTO $LOCUSR ($MATCH)"
LOCUSR=ml
ADREXP=mlvtol(_at_)isolution\(_dot_)nl
:0 fh w
*$ ^TO()\/$ADREXP
| $FORMAIL -A"$XTO $LOCUSR ($MATCH)"
:0 E fh w
*$ ^Received: .*()\/for (<)$ADREXP(>)
| $FORMAIL -A"$XTO $LOCUSR ($MATCH)"
LOCUS1="wvw "
LOCUS2="rovabu"
LOCUS3="ruud "
ADREXP=(wvw|rovabu)@isolution\.nl
:0 fh w
*$ ^TO()\/$ADREXP
| $FORMAIL -A"$XTO $LOCUS1 ($MATCH)" \
-A"$XTO $LOCUS2 ($MATCH)" \
-A"$XTO $LOCUS3 ($MATCH)"
LOCUS1="ruud"
LOCUS2="mj "
ADREXP=info(_at_)isolution\(_dot_)nl
:0 fh w
*$ ^TO()\/$ADREXP
| $FORMAIL -A"$XTO $LOCUS1 ($MATCH)" \
-A"$XTO $LOCUS2 ($MATCH)"
LOCUS1="ruud"
LOCUS2="-mj-"
:0 fh w
*$ $from_mailer
| $FORMAIL -A"$XTO $LOCUS1 (FROM_MAILER)" \
-A"$XTO $LOCUS2 (FROM_MAILER)"
:0 fh w
*$ !^$XTO
| $FORMAIL -A"$XTO ???"
:0 fh w
| $FORMAIL -A"$XD1 END"
#=============================================================
# Step 2/3: deliver copy of message to individual address(es)
# and append to user's backup file
#-------------------------------------------------------------
:0 c
*$ ^$XTO ()\/ruud
! $MATCH(_at_)localhost
:0 A c
$BUDIR$MUSR.$YYYYMMDD.$MATCH
:0 c
*$ ^$XTO ()\/mj
! $MATCH(_at_)localhost
:0 A c
$BUDIR$MUSR.$YYYYMMDD.$MATCH
:0 c
*$ ^$XTO ()\/joke
! $MATCH(_at_)localhost
:0 A c
$BUDIR$MUSR.$YYYYMMDD.$MATCH
:0 c
*$ ^$XTO ()\/ml
! $MATCH(_at_)localhost
:0 A c
$BUDIR$MUSR.$YYYYMMDD.$MATCH
:0 c
*$ ^$XTO ()\/wvw
! $MATCH(_at_)localhost
:0 A c
$BUDIR$MUSR.$YYYYMMDD.$MATCH
:0 c
*$ ^$XTO ()\/rovabu
! $MATCH(_at_)localhost
:0 A c
$BUDIR$MUSR.$YYYYMMDD.$MATCH
#============================================================
# Step 3/3: append cooked message to a local file
#------------------------------------------------------------
:0 : $MUSR$LOCKEXT
*$ ^$XTO (ruud|mj|joke|ml|wvw|rovabu)
$BUDIR$MUSR.$YYYYMMDD.cooked
:0 : postmaster$LOCKEXT
*$ $from_mailer
$BUDIR$MADM.$YYYYMMDD
#======================================
# If not 'delivered' yet, mail to ruud
#--------------------------------------
:0
! ruud(_at_)localhost