Discussion:
mailpng.module
(too old to reply)
Brian Johnson
2006-06-12 19:17:00 UTC
Permalink
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
Torben Pollmann
2006-06-13 06:57:22 UTC
Permalink
Post by Brian Johnson
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
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
}
Have you got the same thing for incoming voice msgs?

Please post!
--
Die unaufgeforderte Zusendung einer Werbemail an Privatleute verstoesst
gegen §1 UWG und §823 I BGB (Beschluss des LG Berlin vom 2.8.1998, Az:
16 O 201/98).Jede kommerzielle Nutzung der uebermittelten persoenlichen
Daten sowie deren Weitergabe an Dritte ist ausdruecklich untersagt!

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Antoine Jacoutot
2006-06-13 07:29:16 UTC
Permalink
Post by Torben Pollmann
Have you got the same thing for incoming voice msgs?
I have one...
Here it is (be careful at the wrapping):

##########
#!/bin/sh

extension="wav"
contenttype="audio/x-wav"

fn=$1
tempfn=/tmp/voice.temp

email=root

seperator="========== $$fn =========="

echo To: $email > $tempfn
echo From: ${email}@`hostname` >> $tempfn
echo Subject: Message vocal: `/bin/date +%d-%m-%Y` - `/bin/date +%Hh%M` >>
$tempfn
echo Mime-Version: 1.0 >> $tempfn
echo Content-Type: multipart/mixed\; boundary=\"$seperator\" >> $tempfn
echo "">> $tempfn

pagefn=voice.$$.$extension

outputfn=$fn.$extension

/usr/local/bin/rmdtopvf $fn | /usr/local/bin/pvftowav 2>/dev/null > $outputfn

echo --$seperator >> $tempfn
echo Content-Type: $contenttype\; name=\"$pagefn\" >> $tempfn
echo Content-Transfer-Encoding: base64 >> $tempfn
echo Content-Disposition: attachment\; filename=\"$pagefn\" >> $tempfn
echo "">> $tempfn
/usr/local/bin/base64 $outputfn >> $tempfn

rm -f $outputfn

echo --$seperator >> $tempfn

/usr/sbin/sendmail < $tempfn $email
rm -f $tempfn
rm -f $1
##########
--
Antoine

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Brian Johnson
2006-06-13 12:33:28 UTC
Permalink
Sorry no. We use asterisk for VOIP, not mgetty
Post by Torben Pollmann
Post by Brian Johnson
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
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`-$-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
}
Have you got the same thing for incoming voice msgs?
Please post!
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Loading...