Snow Leopard: Mail.app not recognizing Unix attachments as before…
16/09/09 13:53
If under Leopard and before, you received email messages containing attachments the old Unix way:
begin 644 filename.ext
...uuencode stream here...
end
you may be surprized to see that Snow Leopard doesn't allow to use quick view anymore even if the attachement is of well known file extension (.html as an exemple…)
begin 644 filename.ext
...uuencode stream here...
end
you may be surprized to see that Snow Leopard doesn't allow to use quick view anymore even if the attachement is of well known file extension (.html as an exemple…)
If under Leopard and before, you received email messages containing attachments the old Unix way:
begin 644 filename.ext
...uuencode stream here...
end
you may be surprized to see that Snow Leopard doesn't allow to use quick view anymore even if the attachement is of well known file extension (.html as an exemple…)
The attachment is now displayed as a "Mail Attachment" and visible only in any text editor… with TextEdit proposed as the default one.
Quite annoying if you have Unix jobs sending you automatic reports with bash lines like this:
uuencode filename.ext filename.ext | mail -s "My beautiful report" reader@mycompany.com
This doesn't work as before if "reader" is now using Snow Leopard… You have to do something like this:
#!/bin/sh
function usage
{
echo "Usage: $0 [-h] | [-t mimetype] [-e encoding] pathtoreport from to cc [cc ...]" 1>&2
}
set -- `getopt ht:e: "$@"` || {
exit 1
}
# our defaults: set yours…
mimetype="text/html"
encoding="ISO-8859-1"
while :
do
case "$1"
in
-t)
mimetype=$2; shift 2;;
-e)
encoding=$2; shift 2;;
-h)
help=$1; shift;;
--)
shift; break;;
esac
done
if test "$help" = "-h"
then
usage
exit 0
fi
if [ $# -lt 4 ]
then
usage
exit 1
fi
pathtoreport=$1
from=$2
to=$3
cc=$4
shift 4
ccs=$@
for cc1 in "$ccs"
do
cc="$cc, $cc1"
done
subject=`basename $pathtoreport`
b=`date +%Y%m%d%H%M%s`
boundary="--MYBOUNDARY_ID-"$b
(
cat < MIME-Version: 1.0
To: $to
Cc: $cc
Content-type: multipart/alternative; boundary=$boundary
From: $from
Subject: $subject
Reply-To: $from
$boundary
Content-Transfer-Encoding: quoted-printable
Content-Type: $mimetype;
charset=$encoding
$(cat "$pathtoreport")
$boundary
EOF
) | /usr/sbin/sendmail -t
And call it that way:
sendreport.sh PATH_TO/filename.ext sender@thisserver.com reader@mycompany.com other@mycompany.com
Feel free to adapt to your taste and context of usage... And of course, if you know of another solution invoking only some settings to change at client side under Snow Leopard: let us know !
begin 644 filename.ext
...uuencode stream here...
end
you may be surprized to see that Snow Leopard doesn't allow to use quick view anymore even if the attachement is of well known file extension (.html as an exemple…)
The attachment is now displayed as a "Mail Attachment" and visible only in any text editor… with TextEdit proposed as the default one.
Quite annoying if you have Unix jobs sending you automatic reports with bash lines like this:
uuencode filename.ext filename.ext | mail -s "My beautiful report" reader@mycompany.com
This doesn't work as before if "reader" is now using Snow Leopard… You have to do something like this:
#!/bin/sh
function usage
{
echo "Usage: $0 [-h] | [-t mimetype] [-e encoding] pathtoreport from to cc [cc ...]" 1>&2
}
set -- `getopt ht:e: "$@"` || {
exit 1
}
# our defaults: set yours…
mimetype="text/html"
encoding="ISO-8859-1"
while :
do
case "$1"
in
-t)
mimetype=$2; shift 2;;
-e)
encoding=$2; shift 2;;
-h)
help=$1; shift;;
--)
shift; break;;
esac
done
if test "$help" = "-h"
then
usage
exit 0
fi
if [ $# -lt 4 ]
then
usage
exit 1
fi
pathtoreport=$1
from=$2
to=$3
cc=$4
shift 4
ccs=$@
for cc1 in "$ccs"
do
cc="$cc, $cc1"
done
subject=`basename $pathtoreport`
b=`date +%Y%m%d%H%M%s`
boundary="--MYBOUNDARY_ID-"$b
(
cat <
To: $to
Cc: $cc
Content-type: multipart/alternative; boundary=$boundary
From: $from
Subject: $subject
Reply-To: $from
$boundary
Content-Transfer-Encoding: quoted-printable
Content-Type: $mimetype;
charset=$encoding
$(cat "$pathtoreport")
$boundary
EOF
) | /usr/sbin/sendmail -t
And call it that way:
sendreport.sh PATH_TO/filename.ext sender@thisserver.com reader@mycompany.com other@mycompany.com
Feel free to adapt to your taste and context of usage... And of course, if you know of another solution invoking only some settings to change at client side under Snow Leopard: let us know !