HylaFAX The world's
most advanced open source fax server
|
|
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
Re: [hylafax-users] mail attachment not be faxed
On 28-Aug-2001 Lee Howard wrote:
> At 02:40 PM 8/28/01 +0200, Kaeidinejad, Shahram wrote:
>>Hi,
>>
>>i have configured hylafax with sendmail as mail-to-fax-gateway.
>>That works OK but when the mail have one attachment the attachment will be
>>ignored.
>>can everybody help me?
>
> If you're using faxmail, then you can only use ASCII or Postscript
> attachments.
>
> Lee.
or you try my setup - i can successfully send emails with attached pdf files
which are faxed afterwards.
here is what to do:
=========
Date: Thu, 23 Aug 2001 18:48:18 +0200 (MET DST)
From: Niki W. Waibel <niki.waibel@newlogic.com>
To: hylafax-users@hylafax.org
hylafax-devel@hylafax.org
Subject: [hylafax-users] sending fax via pdf files in email
hi,
because the core hylafax sw has no support for sending faxes via
attached pdf files in emails...
and because our marketing department forced me to write such
a thing...
i'd like to post my solution here.
i have written it as fast as possible and so the scripts are far from
being complete but it works for what we need it.
my solution is:
* sending a email with a or more pdf file(s) to a special user
on the hylafax server.
* the email has to include a line like `Number: 123-456-789'
* the special user on the hylafax server has a .forward file which
pipes his emails to a script.
* the script calles metamail to extract the files in the email and then
it calles sendfax (which can fax pdf files).
nice, isn't it?
more or less no modification on sendmail is neccessary.
here is the script (i'd like to call it version 0.0.1 ;-) )
===
# root # @fax-gw ~ # cat /home/mail2fax/bin/xxx
#!/bin/sh
SENDFAX=/usr/local/bin/sendfax
TMP_MESSAGE_DIR=/home/mail2fax/tmp_files
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}
# grep information of the message
FAX_FROM=`grep -i "^From: " ${TMP_MESSAGE_FILE} | sed -e "s/^......//"`
FAX_REGARDING=`grep -i "^Subject: " ${TMP_MESSAGE_FILE} | sed -e
"s/^.........//"`
FAX_NUMBER=`grep -i "^Number: " ${TMP_MESSAGE_FILE} | sed -e
"s/^........//"`
FAX_NAME=`grep -i "^Name: " ${TMP_MESSAGE_FILE} | sed -e "s/^......//"`
FAX_COMPANY=`grep -i "^Company: " ${TMP_MESSAGE_FILE} | sed -e
"s/^.........//"`
FAX_COMMENTS=`grep -i "^Comments: " ${TMP_MESSAGE_FILE} | sed -e
"s/^..........//"`
# invoke metamail
mkdir ${METAMAIL_TMPDIR}
metamail -x -w ${TMP_MESSAGE_FILE} 2>&1 > /dev/null
# invoke sendfax
for i in ${METAMAIL_TMPDIR}/*.pdf
do
${SENDFAX} \
-n \
-m \
-D \
-c "${FAX_COMMENTS}" \
-d "${FAX_NUMBER}" \
-f "${FAX_FROM}" \
-r "${FAX_REGARDING}" \
-x "${FAX_COMPANY}" \
"$i"
done
# create mail/fax info
echo
"===============================================================================
" >> ${LOG_FILE}
echo "From:" >> ${LOG_FILE}
echo " ${FAX_FROM}" >> ${LOG_FILE}
echo "" >> ${LOG_FILE}
echo "Regarding:" >> ${LOG_FILE}
echo " ${FAX_REGARDING}" >> ${LOG_FILE}
echo "" >> ${LOG_FILE}
echo "To:" >> ${LOG_FILE}
echo " ${FAX_NUMBER}" >> ${LOG_FILE}
echo " ${FAX_NAME}" >> ${LOG_FILE}
echo " ${FAX_COMPANY}" >> ${LOG_FILE}
echo "" >> ${LOG_FILE}
echo "Comments:" >> ${LOG_FILE}
echo " ${FAX_COMMENTS}" >> ${LOG_FILE}
echo "" >> ${LOG_FILE}
# cleanup the dirs and files
rm -rf ${METAMAIL_TMPDIR}
rm ${TMP_MESSAGE_FILE}
===
and here is the .forward file of the user mail2fax:
===
# root # @fax-gw ~ # cat /home/mail2fax/.forward
"|/home/mail2fax/bin/xxx mail2fax"
===
dont forget that you have to install the metamail rpm!
have fun, niki
=========
--
niki w. waibel - system administrator @ newlogic technologies ag
____________________ HylaFAX(tm) Users Mailing List _______________________
To unsub: mail -s unsubscribe hylafax-users-request@hylafax.org < /dev/null