HylaFAX The world's most advanced open source fax server

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

Re: Incoming fax send as mail




Hi Thomas,

Hmmm... what could be wrong...

(*) My scripts expect to find the hylafax spool directory in
    /var/spool/fax, and to be run from that directory.

(*) You can test faxrcvd-mail by hand like so:

    cd /var/spool/fax
    ./bin/faxrcvd-mail recvq/00000001 ttyS0 000000001 '' faxadmin fax

    (the file recvq/00000001 should be an incoming fax with a
    connection log in log/c00000001).  This program should print a
    MIME message with the fax as an attachment.  If not, you can send
    me the output.

--Noel





> X-Real-To: <noel@burton-krahn.com>
> From: Thomas Nilsen <Thomas.Nilsen@Kverneland.com>
> Cc: "hylaFAX (E-mail)" <flexfax@sgi.com>
> Date: Fri, 17 Sep 1999 12:10:48 +0200
> Content-Type: text/plain;
> 	charset="iso-8859-1"
> X-UIDL: d1341b0822aa8a8d608b5b6a1b9b34e3
> 
> Noel,
> 
> Thanks for the script!
> 
> I've installed your scripts, but I am not able to get them to work properly.
> All I get is an empty mail message from uucp.
> 
> As far as I can see the problem is in the faxrcvd-mail script. I'm not sure
> if it kicks of as expected? Version running is...
> 
> Perl 5.005_03
> Hylafax 4.1beta1-rh6 
> 
> Are there any special options I need to configure on the system before I use
> the script maybe?
> 
> Regards, Thomas
> -----Original Message-----
> From: Noel Burton-Krahn [mailto:noel@burton-krahn.com]
> Sent: Monday, September 13, 1999 6:33 PM
> To: Thomas.Nilsen@Kverneland.com
> Cc: flexfax@sgi.com
> Subject: Re: flexfax: Incoming fax send as mail
> 
> 
> 
> 
> I rewrote faxrcvd to call a perl script faxrcvd-mail.  faxrcvd-mail
> uses mimencode to encode the fax as base64.  I'll attach my two
> scripts below faxrcvd and faxrcvd-mail.  I hope they help.  I have
> been using them on a redhat-6.0 box.
> 
>     noel@prospero:~$ uname -a
>     Linux prospero.burton-krahn.com 2.2.10 #4 SMP Tue Jun 15 23:08:13 PDT
> 1999 i586 unknown
> 
>     noel@prospero:~$ rpm -q hylafax
>     hylafax-4.1beta1-1rh6
> 
> --Noel
> 
> 
> 
> > X-Real-To: <noel@burton-krahn.com>
> > From: Thomas Nilsen <Thomas.Nilsen@Kverneland.com>
> > Date: Mon, 13 Sep 1999 10:50:53 +0200
> > Sender: owner-flexfax@celestial.com
> > Precedence: bulk
> > Content-Type: text/plain;
> > 	charset="iso-8859-1"
> > X-UIDL: 208b36a08671b4de8b2b2fafcaed1b95
> > 
> > Can anyone suggest a quick and easy way for getting the faxrcvd script to
> > send the incoming faxes as mail with the actual fax as an attachment? I've
> > not been able to figure out how to add the fax as an attachment to the
> mail
> > sent....
> > 
> > Regards, Thomas Nilsen
> > Global Services
> > Kverneland IT AS
> > Phone: +47 51429306 - Mobile: +47 95258962
> > 
> > 
> 
> 
> 
> 
> #---------------------------------------------------------------------
> #! /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, "faxinfo $file|") || die("faxinfo $file: $!");
> while(<IN>) {
>     $info .= $_;
>     $info{lc($1)} = $2 if( /^\s*(\S+): (.*)$/ );
> }
> close(IN) || die("faxinfo: $?");
> 
> print <<EOF
> From: $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
> 
> #---------------------------------------------------------------------
> #! /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=`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
> 
> TOADDR=faxadmin
> PATH="$SPOOL/sbin:$SPOOL/bin:$PATH"
> 
> if faxrcvd-mail "$FILE" "$DEVICE" "$COMMID" "$MSG" "$TOADDR" fax | sendmail
> $TOADDR; then
> 	rm -f $FILE
> fi
> 




Project hosted by iFAX Solutions