On 2000-05-27 21:49:21 -0400, John P. Verel wrote:

> Ah.  So the issue is the sender, in this case
> presumably Lotus Notes.

Yes, it is, and it is complete and utter brain-damage on
Lotus' side.  For some kind of handler, you may try the
attached shell script, which helps at least in some
situations.

(For storing the attachments, piping to uudecode is
entirely fine, though.)

-- 
http://www.guug.de/~roessler/
#!/bin/bash

##
## View X-Lotus-Notes attachments.
##

mimetypes=/usr/local/share/mime.types
metamail="/usr/local/bin/metamail -m mutt"

tmpdir=/tmp/lotus.$$
trap 'rm -rf $tmpdir' 0 1 2 3

mkdir $tmpdir || exit 1

## -B means that we are used in an autoview filter.

if [ "$1" = "-B" ] ; then
        metamail="$metamail -B -x -q"
        
MAILCAPS=${MAILCAPS-$HOME/.mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap}
        for i in `echo $MAILCAPS | tr : \ ` ; do
                [ -f $i ] && { grep copiousoutput $i >> $tmpdir/mailcap ; }
        done
        export MAILCAPS=$tmpdir/mailcap
        export MM_PAGER=cat
        shift
else
        metamail="$metamail -p"
fi

[ -z "$1" ] || { exec < $1 || exit 1 ; }

cd $tmpdir

cat > data
extension=`sed -n -e 's/^begin .*\.\([^.]*\)$/\1/p' data | tr '[A-Z]' '[a-z]'`
tmpfile=data.$extension
sed -e "s/^begin .*\$/begin 600 $tmpfile/" data | uudecode
ctype=`awk '/^[^#]/   { 
                        for(i = 2; i <= NF; i++) {
                          if($i == "'"$extension"'") {
                            printf("%s", $1);
                            exit;
                          }
                        }
                      }' $mimetypes`

if [ -z "$ctype" -o \( "$ctype" = "text/plain" \)  ] ; then
        recode ibmpc:latin1 $tmpfile
        ${MM_PAGER-less} $tmpfile
        exit
fi

$metamail -b -c $ctype $tmpfile

Reply via email to