procmail
[Top] [All Lists]

Re: Using Formail to remove headers

2005-07-31 15:08:25
On Sun, Jul 31, 2005 at 10:03:27PM +0100, Stephen Allen wrote:

Currently, I remove all Received: headers as a courtesy to
others, but I ws thinking I don't actually need any header except
To:, From:, Subject: and anything to do with MIME.

So, the million dollar question, how to remove all headers except
the above?

One way: Save the headers you want into vars, remove all headers,
put the headers you want back.


  :0
  * ^\/From:.*
  { H_FROM = $MATCH }


  :0
  * ^\/Subject:.*
  { H_SUBJ = $MATCH }


  :0
  * ^\/Content-Type:.*
  { H_CTYPE = $MATCH }

  :0
  * ^\/MIME-Version:.*
  { H_MIME = $MATCH }


  :0
  * ^\/Content-Transfer-Encoding:.*
  { H_CTE = $MATCH }


  :0
  * ^\/Content-Disposition:.*
  { H_DISPO = $MATCH }
  


  :0
  | formail -I ""         \
            -I "$H_FROM"  \
            -I "$H_SUBJ"  \
            -I "$H_CTYPE" \
            -I "$H_MIME"  \
            -I "$H_CTE"   \
            -I "$H_DISPO" \
  | $SENDMAIL $SENDMAILFLAGS -t someone(_at_)somewhere


Tested, but for the sendmail pipe.


Dallman

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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