procmail
[Top] [All Lists]

Re: Message with text/plain and text/html

2003-02-15 18:45:28
Current recipe:

VERBOSE=ON
:0c
* ^Content-type:(.*\<)multipart.*boundary="\/.*[^"]"
{
  BOUNDARY=$MATCH
  :0 Bfw
  * ^Content-type:(.*\<)text/html
  | sed -e '/Content-Type: text\/html;/,/$BOUNDARY/d'

  :0 A
  {
        :0 ABfw
        | sed -e '/$BOUNDARY/d'
        :0 ABfw
        | sed -e '/Content-Type: text/d'
        :0 fBw
        | sed -e '/charset=/d' \
              -e '/Content-Transfer-Encoding:/d' \
              -e '/This is a multipart message in MIME format/d' \
  }

  :0 Afw
  | formail -i"Content-Type: text/plain" \
            -i"X-HTML: Altered text/html to text/plain"
}
VERBOSE=OFF

This basically works to strip out the HTML portion of a message and leave only the text portion behind.

However, it leaves the text/plain portion of the message's $BOUNDARY

5-Feb-2003 18:00:09
procmail: Skipped "-i "X-Spamtrap: html with no multipart""
procmail: Skipped "-i "X-Spam-Flag: Yes""
Subject: Simple how-to
To: <spamassassin-talk(_at_)lists(_dot_)sourceforge(_dot_)net>
From: Ron Weales <ron(_at_)airtalk(_dot_)com>
procmail: [14598] Sat Feb 15 18:00:09 2003
procmail: Assigning "MATCH="
procmail: Matched "73000026-POCO-86534621""
procmail: Match on "^Content-type:(.*\<)multipart.*boundary="\/.*[^"]""
procmail: Forking "procmail"
procmail: Assigning "VERBOSE=OFF"
procmail: [14615] Sat Feb 15 18:00:09 2003
procmail: Assigning "BOUNDARY=73000026-POCO-86534621""
procmail: Match on "^Content-type:(.*\<)text/html"
procmail: Executing " sed -e '/Content-Type: text\/html;/,/$BOUNDARY/d'"
procmail: Executing "sed,-e,/$BOUNDARY/d"
procmail: Executing "sed,-e,/Content-Type: text/d"
procmail: Executing "sed,-e,/charset=/d,-e,/Content-Transfer-Encoding:/d,-e,/This is a multipart message in MIME format/d,-e,/$BOUNDARY/d" procmail: Executing "formail,-iContent-Type: text/plain,-iX-HTML: Altered text/html to text/plain"
procmail: Assigning "VERBOSE=OFF"
From spamassassin-talk-admin(_at_)lists(_dot_)sourceforge(_dot_)net Thu Feb 6 13:15:11 2003
 Subject: Simple how-to
Folder: /Users/kremels/Library/Mail/Mailboxes/(UnixStuff)/SATalk.Feb- 5545 From spamassassin-talk-admin(_at_)lists(_dot_)sourceforge(_dot_)net Thu Feb 6 13:15:11 2003
 Subject: Simple how-to
Folder: /Users/kremels/Library/Mail/Mailboxes/(UnixStuff)/SATalk.Feb- 5678

but the message begins:

Subject: Simple how-to
Reply-To: spamassassin-talk(_at_)lists(_dot_)sourceforge(_dot_)net
List-Id: Talk about SpamAssassin <spamassassin-talk.lists.sourceforge.net> X-Spam-Status: No, hits=1.4 required=3.0 tests=BIG_FONT,KNOWN_MAILING_LIST,MIME_HTML_NO_CHARSET, SPAM_PHRASE_01_02,SUPERLONG_LINE version=2.44
X-Html: Altered text/html to text/plain


--73000026-POCO-86534621

so sed,-e '/$BOUNDARY/d'

is failing to match that boundary, but does match the boundary on the previous condition:

procmail: Executing " sed -e '/Content-Type: text\/html;/,/$BOUNDARY/d'"

What am I missing?


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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