procmail
[Top] [All Lists]

Re: [procmail] relaying messages

1999-08-07 12:52:16
John Conover wrote:

<> When using something like:
<> 
<>     :0
<>     * ^To:.*someone
<>     ! someone(_at_)somedomain(_dot_)com
<> 
<> in a procmail script, the "From someone(_at_)someplace(_dot_)com ..." record 
in
<> the email is changed to the account and machine that procmail is
<> running on.
<> 
<> Can the original "From " record be preserved?

Yes, but ...  (There's always a but, eh?)  The "From " header is the
envelope -- if your recipe goes awry, such as forwarding mail to an
unknown destination (Ie., "somedomain.com" got dropped from the root
domain servers) or if the user account is cancelled, the error message
normally[1] gets sent to the envelope sender.

It probably is more appropriate to have those boucnes from to the guy who
is doing the forwarding of the message -- you, than to the person who
sent the message ('cos, after all, the address _he_ sent it to is valid ...)

If you insist, try something like this (untested, check it over before
using!):

  :0
  * ^To:.*someone
  * ^From[       ]+\/[-!#-'*+/-9=?A-Z^-~]+(_at_)[-!#-'*+/-9=?A-Z\.^-~]+
  | $SENDMAIL -f $MATCH -oi -t someone(_at_)somedomain(_dot_)com
  
The thing in the brackets is "[<tab><space>]" and the odd thing after
"\/" tells procmail to get the address part of the from (and not the date
string, if any) and stick it in the variable $MATCH

(That regex is ugly; anyone who's more comfortable with them care to send
me -- and Mr. Conover -- something prettier?)

Reto

[1] For all values of normal that don't include MickeySquish "products"
-- 
R A Lichtensteiger       rali(_at_)meitca(_dot_)com -or- 
rali(_at_)world(_dot_)std(_dot_)com
                         http://www.meitca.com/ITA/People/rali
    "Yes, you're doing things right, but are you doing the right things?"
    "Nope.  I'm just doing something dumb fast."

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