Hi! After further investigation of the problem I've written a script for procmail or any other mail filter program. This script does one nice thing, which I missed in "formail". "formail" can only change lines in the header of emails. The Content-Type being to be changed for pgp attachments is in the body of the email. Therefore my script scans through the body of an email. If it finds an attachment with the sequence "^-----BEGIN PGP MESSAGE-----" it changes the Content-Type of the attachment to "Content-Type: application/pgp; format=text; x-action=encrypt". The header of the email stays "multipart/". To get procmail execute the script, the whole pgp section in my .procmailrc is now: ---------------------------- cut here ---------------------------- ## ## PGP ## MAILFILTER_PGP_ATTACHMENT=${HOME}/bin/mailfilter_pgp_attachment :0 * !^Content-Type: message/ * !^Content-Type: multipart/ * !^Content-Type: application/pgp { :0 fBw * ^-----BEGIN PGP MESSAGE----- * ^-----END PGP MESSAGE----- | $FORMAIL -i "Content-Type: application/pgp; format=text; x-action=encrypt" :0 fBw * ^-----BEGIN PGP SIGNED MESSAGE----- * ^-----BEGIN PGP SIGNATURE----- * ^-----END PGP SIGNATURE----- | $FORMAIL -i "Content-Type: application/pgp; format=text; x-action=sign" } :0 * ^Content-Type: multipart/ { :0 fBw * ^-----BEGIN PGP MESSAGE----- * ^-----END PGP MESSAGE----- | $MAILFILTER_PGP_ATTACHMENT - } ---------------------------- cut here ---------------------------- The filter script "mailfilter_pgp_attachment" is attached to this msg. What do you think about this solution? Ideas, comments are welcome. Regards, Daniel. On Wed, Feb 07, 2001 at 10:28:00AM +0100, Daniel Kollar wrote: > Date: Wed, 7 Feb 2001 10:28:00 +0100 > From: Daniel Kollar <[EMAIL PROTECTED]> > To: Mutt User List <[EMAIL PROTECTED]> > Subject: multipart application/pgp > Mail-Followup-To: Mutt User List <[EMAIL PROTECTED]> > > Hi! > > I often get emails with several pgp encrypted attachments. > > The "Content-Type" in the header of the message is "multipart/", so > mutt does not recongnize the pgp encryption. > Procmail can change this "multipart/" content type to "application/pgp". > Now mutt can decrypt the whole msg and show it in the pager. This works fine, as >long as > there are only ASCII attachments encrypted. > But when there are e.g. tar, gz attachments or images, I run into > problems. > > Nice would be, if mutt could recognize the multipart and the encryption. > Then the normal attachment browser could be used to read or save the > attachments separately. > > What do you think about this? > > > Regards, > Daniel.
eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; ($script = $0) =~ s#.*/(.*)$#$1#; $USAGE = " # Usage: $script mail # # Task: This script converts the Content-Type of attachments to # application/pgp ... # if the attachment is pgp encrypted. # The output will be the stdout. # # Version : 1.0 # Author: Daniel.Kollar\@bigfoot.de # "; $user=`whoami`; $date=`date`; die "$USAGE" if @ARGV == 0; $header = 1; while (<>) { $line = $_; if ( $header && $line =~ /^[\s\t]*$/ ) { $header = 0; print "$line"; next; } if ( $header == 1 ) { # skip header print "$line"; next; } if ( !$header && $line =~ /^------.*/ ) { print "$line"; $aheader = 1; @lines1 = (); $content_type = ""; @lines = (); while (<>) { $line = $_; if ( $aheader && $line =~ /^Content-Type:.*/) { # save Content-Type separately @lines1 = @lines; $content_type = $line; @lines = (); next; } if ( $aheader && $line =~ /^[\s\t]*$/ ) { # look for header of attachment $aheader = 0; push(@lines, $line); next; } if ( $aheader == 1 ) { push(@lines, $line); next; } if ( !$aheader && $line =~ /^-----BEGIN PGP MESSAGE-----.*/ ) { # attachment pgp encrypted $content_type = "Old-${content_type}Content-Type: application/pgp; format=text; x-action=encrypt\n"; push (@lines, $line); next; } if ( !$aheader && $line =~ /^------.*/ ) { # next attachment begins print join '',@lines1; print "$content_type"; print join '',@lines; print "$line"; $aheader = 1; @lines1 = (); $content_type = ""; @lines = (); next; } push(@lines, $line); } print join '',@lines1; print "$content_type"; print join '',@lines; last; } print "$line"; }