On 2012-11-26, Jamie Paul Griffin <ja...@kode5.net> wrote:

> Does anyone have or know of a perl or python script, or even a shell
> script, that removes the multipart/(mixed|alternative| ... ) parts of
> incoming mail and leaves or converts the message into plain text?

Here's the Python program I use to handle mime messages with slrn:

  http://www.panix.com/~grante/files/unmime.py

For multipart/alternative:

  It will pick the text/plain version if there is one and output that.
  If there isn't plaintext, it will look for an text/html version and
  render it with w3m.  If there is neither text/plain nor text/html,
  then it will just output all the parts as best it can.

For multipart/mixed:

  It will show text/plain attachments as-is and will render html
  attachments using w3m.  For other attachments it just outputs some
  placeholder text.

However, I'm not sure that it would be useful as-is in a procmail
recipe -- it's intended for use when viewing messages, so you do
"loose" attachements that aren't text/plain or text/html.
  
-- 
Grant Edwards               grant.b.edwards        Yow! My Aunt MAUREEN was a
                                  at               military advisor to IKE &
                              gmail.com            TINA TURNER!!

Reply via email to