Ok, after much help from this list I finally have a working script for
forwarding my mail to my pager. For future reference here is a commented
version of a script that forwards email to my pager only when I am not
checking my mail with pine (or by some other means) and that trims the
From: headers of the emails to use fewer characters.
--- rc.pagerNames ---
# Forwards high priority mail to a pager address
# Set the email address of the pager
PAGER_ADDR=....
# Only forward to the pager if the .pine-running file does
# not exist (so we do not receive pages when pine is running).
:0
* ! ? test -f ~/.pine-running
{
# Send all emails with urgent in the message line to the pager
# The sed script selects either the first word delimited by a
# space, or the userid if the address is just userid(_at_)domain
# and then append @U (at unknown) to prevent sendmail from
# appending @localhost.
:0 c
* ^Subject:.*urgent
| sed -e '/^From:/ {s/ //;s/ .*//;s/<//;s/@.*//;s/$/@U/;}' \
-e 's/^From:/From: /' | $SENDMAIL $PAGER_ADDR
# Send all email from the following people to the pager
# For each user with auto forwarding I have an entry.
# The formail line adds the appropriate alias for each user.
:0 c
* ^From:(_dot_)*someone(_at_)somewhere
| formail -cz -A "From: Sbdy(_at_)s" | $SENDMAIL $PAGER_ADDR ; done
}
# Send all pager test emails to the pager, even if Pine
# is running. Give myeself a short alias.
:0 Dc
* ^Subject: Pager Test$
* ^From:.*progers
| formail -cz -A "From: Me(_at_)I" | $SENDMAIL $PAGER_ADDR ; done
--------------------
Hope this proves useful to future generations. :-)
- Pat