forward incoming email to fax

Herbert Betz (kla@fh-landshut.de)
Sat, 19 Sep 1998 22:21:41 +0200


Converting email to fax:
*************************

1) ~/.procmailrc sends copy of mail to textfile called TEXTTOFAXSOON:

:0 c
* ^To.*Miller
* ^Content-Type: *text/plain
|formail -k -X Date: -X From: -X To: -X Subject: >> ~/TEXTTOFAXSOON

2) Script for sendfax (called from crontab):

#! /bin/bash
faxfile=TEXTTOFAXSOON
faxnr=3471

cd /home/kla
if [ -s ./$faxfile ]; 
then
  echo "faxing $faxfile ..."

#Shift 5 spaces to the right:
  cp ./$faxfile ./$faxfile.bak && \
(while read inp ; do echo "     $inp" ; done <./$faxfile.bak >./$faxfile)
  
  /usr/bin/pbmtext -font ./cour25.pbm <./$faxfile \
       |/usr/bin/pbm2g3 > ./$faxfile.g3

 /usr/sbin/sendfax $faxnr ./$faxfile.g3
  if [ $? -eq 0 ] ;
    then echo "sent: $faxfile $faxnr"  
    /bin/rm ./$faxfile*
    > ./$faxfile
    /bin/chown kla.users ./$faxfile
    /bin/chmod 600 ./$faxfile
    exit 0
  else
    echo "could not send $faxfile"
    exit 1
  fi
else
  echo "no or empty $faxfile"
  exit 0
fi
# end of script

Yours,
Herbert
_____________________________________________
Herbert Betz - Landshut - herbertbetz@csi.com

On Fri, 18 Sep 1998, Christophe Zwecker wrote:
> mgetty/sendfax ? I would use procmail, anyone done it ? hows the
> syntax ?