Hylafax Mailing List Archives
|
[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
Re: [hylafax-users] fax -> email
My faxrcvd & faxrcvd-mail under bin/ is from rpm package, as follows :
=======================================
file : faxrcvd
========================================
#! /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"
test -f etc/setup.cache || {
SPOOL=wd
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
TOADDR=FaxMaster
PATH="$SPOOL/sbin:$SPOOL/bin:$PATH"
if faxrcvd-mail "$FILE" "$DEVICE" "$COMMID" "$MSG" "$TOADDR" fax |
/usr/sbin/sendmail $TOADDR; then
rm -f $FILE
fi
================================================
eof : faxrcvd
================================================
file : faxrcvd-mail
================================================
#! /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) = @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: image/tiff
Content-Description: FAX from $info{sender} at $info{received}
Content-Transfer-Encoding: base64
EOF
;
open(IN, "mimencode $file |") || die ("couldn't mimencode $file: $!");
print while(<IN>);
close(IN) || die("mimencode: $?");
print <<EOF
--$boundary--
EOF
=====================================================
eof : faxrcvd-mail
==
====
Best Regards
Jason Kwok
==============
====
----- Original Message -----
From: Giulio Orsero <giulioo@pobox.com>
To: <hylafax-users@hylafax.org>
Sent: Monday, February 12, 2001 11:29 PM
Subject: Re: [hylafax-users] fax -> email
> On Mon, 12 Feb 2001 14:40:41 +0800, you wrote:
>
> >email is in extention ".dat", which my win98 could not recognize. I have
to
> >save it, and rename it to ".tif" before I can read it. Any suggestion to
> >solve this problem?
> What about your faxrcvd script?
> --
> giulioo@pobox.com
>
>
> ____________________ HylaFAX(tm) Users Mailing List
_______________________
> To unsub: mail -s unsubscribe hylafax-users-request@hylafax.org <
/dev/null
____________________ HylaFAX(tm) Users Mailing List _______________________
To unsub: mail -s unsubscribe hylafax-users-request@hylafax.org < /dev/null