I'd like to use procmail and formail to rewrite uucp-style
headers into internet style.
I run a small Linux system with uucp mail connectivity. I've had
repeated problems with sendmail and smail-3, so I've just
installed a new mail system named "qmail" using procmail for
final local delivery. This works wonderfully --- with one
exception: incoming uucp mail has the local hostname appended as
"@hostname". (Actually that happens to all mail not containing
an "@" in the "From:" header.)
For example, the address of this list appears to users on my
system as
"From:
Informatik(_dot_)RWTH-Aachen(_dot_)DE!procmail(_at_)n2ell(_dot_)columbia(_dot_)md(_dot_)us"
and I'd like to rewrite that so it becomes
"From: procmail(_at_)Informatik(_dot_)RWTH-Aachen(_dot_)DE"
instead
Woooops. We want *all* headers rewritten, not just the above example?
So, let's see how something like this would work:
[ I'm not sure how ALL UUCP addresses work, but here's something I cranked
up that would work on your example. I'm sure with a little work, it
would do what you want. It's ugly -- I'm sure Allan or Phillip would/could
do a much better job: ]
# Grab the "From:" header.
FROM=`$FORMAIL -rtx'To:'`
# Get the domain/host.
# HOST: Strip everything from the after the last '@' and then
# everything up to the last '!'
# DOMAIN: Strip everything after the first '!'.
NEWHOST=`echo $FROM | sed 's/\(_at_)(_dot_)*$//' | sed 's/^.*\!//'`
NEWDOMAIN=`echo $FROM | sed 's/\!.*//'`
# FORMAIL it.
:0 fhw
| $FORMAIL -I"$NEWHOST(_at_)$NEWDOMAIN"
Lates!
------------------------------------
Tim <bodysurf(_at_)netcom(_dot_)com>
"Finger" for PGP v2.6.3ia Public Key
--
Lates!
------------------------------------
Tim <bodysurf(_at_)netcom(_dot_)com>
"Finger" for PGP v2.6.3ia Public Key