Hylafax Mailing List Archives

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

[hylafax-users] To send an Imcoming Fax as pdf in an eMail



Hi,

I want to send an Incoming Fax as attached pdf in a eMail. I have
created the following  files: faxrcvd and faxrcvd-mail( see point 4.4 in
the HylaFax HowTo). 
When a Fax is incoming I get the following error Massage:
FaxGetty[13541]: Bad exit Status 077000 for
"bin/faxrcvd"recvq/fax00007.tiff"ttyS1" "00000089" " "" "
I don't understand this error Message. What's wrong with the faxrcvd
file?

The tools who is need all installed and one right place. The access
rights for faxrcvd and faxrcvd-Mail are rwxr-xr-x root root.

Thanks for any help


Ralf Polakowksi
#! /bin/sh
#
# /var/spool/fax/bin/faxrcvd
# Noel Burton-Krahn <noel@burton-krahn.com>
# Sept 4, 1999
#
# 
# faxrcvd file devID commID error-msg
#
# modified faxrcvd from hylafax which calls faxrcvd-mail
#
if [ $# != 4 ]; then
    echo "Usage: $0 file devID commID error-msg"
    exit 1
fi
FILE="$1"
DEVICE="$2"
COMMID="$3"
MSG="$4"
TRUNCFILE=`echo $FILE | sed -e 's/\.tif//'`

test -f etc/setup.cache || {
    SPOOL=`pwd`
    cat<<EOF

FATAL ERROR: $SPOOL/etc/setup.cache is missing!

The file $SPOOL/etc/setup.cache is not present.  This
probably means the machine has not been setup using the faxsetup(1M)
command.  Read the documentation on setting up HylaFAX before you
startup a server system.

EOF
    exit 1
}
. etc/setup.cache

/usr/bin/tiff2ps -a -O $SPOOL/$TRUNCFILE.ps $SPOOL/$FILE
/usr/bin/ps2pdf $SPOOL/$TRUNCFILE.ps $SPOOL/$TRUNCFILE.pdf

TOADDR=rp
PATH="$SPOOL/sbin:$SPOOL/bin:$PATH"

#
# If you're using faxcron and would like to have the recvq file removed if
# mail delivery was successful, then uncomment this if clause and comment
# the line(s) following.
#
#if faxrcvd-mail "$FILE" "$DEVICE" "$COMMID" "$MSG" "$TOADDR" fax "$TRUNCFILE.pdf" | \
#/usr/sbin/sendmail $TOADDR; then
#       rm -f $SPOOL/$TRUNCFILE*
#fi

if faxrcvd-mail "$FILE" "$DEVICE" "$COMMID" "$MSG" "$TOADDR" fax "$TRUNCFILE.pdf" | \
/usr/sbin/sendmail $TOADDR; then
        rm -f $SPOOL/$TRUNCFILE.pdf
fi
#! /usr/bin/perl -w
#
# /var/spool/fax/bin/faxrcvd-mail
# Noel Burton-Krahn <noel@burton-krahn.com>
# Sept 4, 1999
#
# a replacement for hylafax's faxrcvd which sends the whole fax by email

use strict;


my($file, $device, $commid, $msg, $toaddr, $fromaddr, $pdffile) = @ARGV;

#open(STDOUT, "|send -oi -f fax $toaddr");

my(%info, $info);
my($boundary);

$boundary=join('---', 
               "=Boundary=",
               $$, 
               sprintf('%x', rand(0xffffffff)));

open(IN, "/usr/sbin/faxinfo $file|") || die("/usr/sbin/faxinfo $file:
$!");
while(<IN>) {
    $info .= $_;
    $info{lc($1)} = $2 if( /^\s*(\S+): (.*)$/ );
}
close(IN) || die("/usr/sbin/faxinfo: $?");

print <<EOF
From: HylaFAX Server < $fromaddr >
To: $toaddr
Subject: FAX from $info{sender} at $info{received}
Mime-Version: 1.0
Content-Type: Multipart/Mixed; Boundary=\"$boundary\"
Content-Transfer-Encoding: 7bit

This is a multi-part message in MIME format.

--$boundary
Content-Type: text/plain; charset=us-ascii
Content-Description: FAX information
Content-Transfer-Encoding: 7bit

$info
    
EOF
    ;

if( $msg ne "" ) {
    print <<EOF
The full document was not received because:

    $msg

EOF
;
}
if( open(IN, "<log/c$commid") ) {
    print <<EOF
    ---- Transcript of session follows ----
EOF
;
    print while(<IN>);
    close(IN);
}

print <<EOF
--$boundary
Content-Type: application/pdf; name="FAX from $info{sender} at $info{received}.pdf"
Content-Description: FAX from $info{sender} at $info{received}
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="FAX from $info{sender} at $info{received}.pdf"

EOF
    ;

open(IN, "mimencode $pdffile |") || die ("couldn't mimencode $pdffile: $!");
print while(<IN>);
close(IN) || die("mimencode: $?");

print <<EOF
--$boundary--
EOF


Home
Report any problems to webmaster@hylafax.org

HylaFAX is a trademark of Silicon Graphics Corporation.
Internet connectivity for hylafax.org is provided by:
VirtuALL Private Host Services