procmail
[Top] [All Lists]

Re: Rewriting mail headers with procmail

1996-12-12 18:09:49

[snip]

[ 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"

Wooops again :^( (I must be sleepy).  Typo.  The last line should read:

        | $FORMAIL -I"From: $NEWHOST(_at_)$NEWDOMAIN"

As I said,

I'm not sure how all UUCP BANG!BANG headers come in so I'd make sure to 
keep a "safety net" of the last few emails in an alternate folder 
(described in the PROCMAILEX MAN pages).  Some experimentation will 
obviously need to be done to get this working perfect, but I would think 
this would be a start.

Lates!
------------------------------------
Tim <bodysurf(_at_)netcom(_dot_)com>
"Finger" for PGP v2.6.3ia Public Key

<Prev in Thread] Current Thread [Next in Thread>