HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

email notify with attached fax - the script(?)



Since there seem to be a lot of people out there interested
in the script I'll post it to the list. It looks really terrible, and has
about
no comments in it, but I hope you'll find use for it.

And hey, I'm always interested in an improved and cleaned up version...


Add the following line at the bottom of your notify script :
(/var/spool/fax/bin/notify)

/var/spool/fax/bin/sendtiff $QFILE

 Create the sendtiff script file (also in your /var/spool/fax/bin
directory):
(make sure it is set to a mode so it can be executed by the fax user, like
755)
 --------------begin

 #! /bin/sh
 TIFFBIN="/var/spool/fax/bin"
 MIMENCODE=/usr/bin/mimencode
 FAX2PS=$TIFFBIN/ps2fax


 STATUS=`cat $1 | grep status`

 # check if status of fax is sent

 if [ "$STATUS" = "status:" ]
 then
 DOCNAAM=`cat $1 | grep post | cut -c 16-`
# probably the lamest way to set the vars, but hey, I'm no programmer

 FILE="/var/spool/fax/${DOCNAAM}"
 SENDERNAME=`cat $1 | grep sender | cut -c 8-`
 SENDTO=`cat $1 | grep mail | cut -c 10-`
 JOBID=`cat $1 | grep jobid | cut -c 7-`
 NUMMBER=`cat $1 | grep number | cut -c 8-`
 FNAME="fax${JOBID}.tif"

 # create a temporary tiff file in your tmp directory to include in mail

 $FAX2PS $FILE -o /tmp/$FNAME

     (MIMEBOUNDARY="NextPart$$"
      echo "Mime-Version: 1.0"
      echo "Content-Type: Multipart/Mixed; Boundary=\"$MIMEBOUNDARY\""
      echo "Content-Transfer-Encoding: 7bit"
      echo "To: $SENDERNAME <$SENDTO>"
      echo "From: HylaFAX Faxsender  <fax>"
      echo "Subject: Fax nr${JOBID} sent to ${NUMMER}";
      echo ""
   echo "--$MIMEBOUNDARY"
    echo "Content-Type: application/fax; name=${FNAME}"
   echo "Content-Description: FAX document"
    echo "Content-Transfer-Encoding: base64"
   echo ""
    $MIMENCODE /tmp/$FNAME
   echo ""
   echo "--$MIMEBOUNDARY--"
  ) | 2>&1 /usr/sbin/sendmail -oi $SENDTO

 rm /tmp/$FNAME

 fi


 ---------------end


 Any more question, feel free to mail me.

 Steven






Project hosted by iFAX Solutions