I use procmail, metamail (also available from here), pstotext, and (soon) html-to-ascii to turn all my messages to ASCII text since that's the lowest common denominator for me.

Here's my simple procmail recipe (this depends upon C-shell, not Bourne shell.):

:0
*^content-type: 
{
	:0fw
	|setenv METAMAIL_PAGER cat; setenv MM_NOTTTY 1; \
		setenv MAILCAPS ~/.mailcap.print; \
		setenv KEYHEADS '*'; formail -c | metamail
}

To use this, you must create a file $HOME/.mailcap.print with these contents:

application/dvi; dvi-app-name %s
message/delivery-status; cat %s
image/*; uuencode %s < %s
audio/basic; uuencode %s < %s
compress/compress; print=uuencode %s < %s
application/postscript ; pstotext %s ; description='A Postscript File';\
	compose='getfilename Postscript %s'
postscript-file; pstotext %s
*/*; uuencode %s < %s

Finally, you'll need to apply this patch to metamail. It makes the -x flag work properly through procmail.

*** src/metamail/metamail.c.orig	Thu Dec  5 17:41:32 1996
--- src/metamail/metamail.c	Thu Dec  5 17:41:32 1996
***************
*** 2330,2336 ****
              ConsumeRestOfPart(OutputFP);
      }
  #if !defined(AMIGA) && !defined(MSDOS)
!     if (UsingStandardInput && feof(InputFP) && !freopen("/dev/tty", "r", stdin)) {
          fprintf(stderr, "Warning: Cannot freopen /dev/tty to stdin");
      } else InputFP = stdin;
  #endif
--- 2330,2336 ----
              ConsumeRestOfPart(OutputFP);
      }
  #if !defined(AMIGA) && !defined(MSDOS)
!     if (!MustNotBeTty && UsingStandardInput && feof(InputFP) && !freopen("/dev/tty", "r", stdin)) {
          fprintf(stderr, "Warning: Cannot freopen /dev/tty to stdin");
      } else InputFP = stdin;
  #endif

And you should be ready to rock-n-roll! Changing the above recipe to Bourne shell would probably be trivial.

Robert's Procmail Software

Date Last Modified: Thu Feb 15 16:01:22 UTC 2007