HylaFAX The world's most advanced open source fax server

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

[hylafax-users] script for sendfax only works from shell



I have modified some script from the lists archive to send incoming emails as fax. When I invoke the script from shell (as user fax) everything works fine, but when it is started automatically (it is anchored in postfix) there are problems. The email that should be converted to fax consist of a plain text body and a tiff file attachment.

The problem seems to be the from metamail (see script below) created body file of the email. The tiff file alone is sent without any problems, but the ascii text file leads to:

rule: offset 0 ascii = -- failed (unprintable char 0xfc)
rule: offset 0 ascii = -- failed (unprintable char 0xfc)

whereas the script when involed from shell (fed with an email) logs to:

rule: offset 0 ascii = -- success (result postscript, rule "%F/textfmt -B -f Courier-Bold -Ml=0.4in -p 11 -s %s >%o <%i")
CONVERT "/usr/lib/fax/textfmt -B -f Courier-Bold -Ml=0.4in -p 11 -s default >/tmp//sndfaxiDH8wM </home/tiffax/11139/mm.ypkWRF" ...


Am I missing something?

Here are parts of the script:

#!/bin/sh

SENDFAX=/usr/bin/sendfax
TMP_MESSAGE_DIR=/home/tiffax
TMP_MESSAGE_FILE=${TMP_MESSAGE_DIR}/$$_to_be_faxed.mail
LOG_FILE=${TMP_MESSAGE_DIR}/fax.log

# metamail env
METAMAIL_TMPDIR=${TMP_MESSAGE_DIR}/$$
export METAMAIL_TMPDIR

# store the message
cat > ${TMP_MESSAGE_FILE}

# invoke metamail
mkdir ${METAMAIL_TMPDIR}
metamail -x -w ${TMP_MESSAGE_FILE} 2>&1 > /dev/null

FILES_TO_FAX=""

for i in ${METAMAIL_TMPDIR}/mm*
do
       FILES_TO_FAX="${FILES_TO_FAX} $i"
done

for i in ${METAMAIL_TMPDIR}/*.tif
do
       FILES_TO_FAX="${FILES_TO_FAX} $i"
done

# invoke sendfax for mailbody and tifs
${SENDFAX} \
       -v -v \
       -n \
       -m \
       -D \
       -c "${FAX_COMMENTS}" \
       -f "${FAX_FROM}" \
       -r "${FAX_REGARDING}" \
       -x "${FAX_COMPANY}" \
       -d "${FAX_NUMBER}" \
       $FILES_TO_FAX




____________________ HylaFAX(tm) Users Mailing List _______________________ To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx < /dev/null *To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxxxxx*




Project hosted by iFAX Solutions