Brian Johnson
2006-06-12 19:17:00 UTC
I love this one.
I can't rmember if I modified this one at all, so I thought would post it in
case it wasn't available elsewhere.
Results in emails with inline .png images. Each fax page is very readable and
is only about 60kB
# MODULE mail
# A function to mail a fax to a user
# The files are attached as MIME-encoded png-pictures
#
# Written 1996 by Darko Krizic
#
mailpng()
{
mailer="/usr/sbin/sendmail -t"
log "mail to $data"
(
# some settings
tmp=/tmp/`basename $0`.$$
bound=Newfax_-${$}${$}
# optionally use the name
if [ -z "$name" ]
then
name=$id
fi
# write the mail
echo "\
Subject: Fax from $name ($pages pages) to png
From: ***@xplor.ipf.de (Fax Subsystem)
To: $data
MIME-Version: 1.0
Content-type: multipart/mixed; boundary=\"$bound\"
--$bound
Content-Type: text/plain;
A new fax has arrived and a png has been created
Sender ID: $id
Name: $name
Pages: $pages
"
for file in $*
do
echo $file
done
for file in $*
do
echo "--$bound"
page=`echo $file | /usr/bin/awk -F\. '{ printf "%d", $NF }' -`
echo "Content-Type: image/png;
name=\"`date`-${id}-page${page}.png\";"
echo "Content-transfer-encoding: base64"
echo
# Attach a 0.5 size png (approx 132k)
/usr/bin/g32pbm $file 2>>$log \
| pnmscale 0.5 2>>$log \
| pnmtopng 2>>$log \
| mimencode 2>>$log
echo
done
echo "--$bound--"
) | tee /var/log/faxmail | $mailer
}
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
I can't rmember if I modified this one at all, so I thought would post it in
case it wasn't available elsewhere.
Results in emails with inline .png images. Each fax page is very readable and
is only about 60kB
# MODULE mail
# A function to mail a fax to a user
# The files are attached as MIME-encoded png-pictures
#
# Written 1996 by Darko Krizic
#
mailpng()
{
mailer="/usr/sbin/sendmail -t"
log "mail to $data"
(
# some settings
tmp=/tmp/`basename $0`.$$
bound=Newfax_-${$}${$}
# optionally use the name
if [ -z "$name" ]
then
name=$id
fi
# write the mail
echo "\
Subject: Fax from $name ($pages pages) to png
From: ***@xplor.ipf.de (Fax Subsystem)
To: $data
MIME-Version: 1.0
Content-type: multipart/mixed; boundary=\"$bound\"
--$bound
Content-Type: text/plain;
A new fax has arrived and a png has been created
Sender ID: $id
Name: $name
Pages: $pages
"
for file in $*
do
echo $file
done
for file in $*
do
echo "--$bound"
page=`echo $file | /usr/bin/awk -F\. '{ printf "%d", $NF }' -`
echo "Content-Type: image/png;
name=\"`date`-${id}-page${page}.png\";"
echo "Content-transfer-encoding: base64"
echo
# Attach a 0.5 size png (approx 132k)
/usr/bin/g32pbm $file 2>>$log \
| pnmscale 0.5 2>>$log \
| pnmtopng 2>>$log \
| mimencode 2>>$log
echo
done
echo "--$bound--"
) | tee /var/log/faxmail | $mailer
}
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de