#! /usr/bin/perl -w # # /var/spool/hylafax/bin/faxrcvd-mail # Noel Burton-Krahn # 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, $psfile) = @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() { $info .= $_; $info{lc($1)} = $2 if( /^\s*(\S+): (.*)$/ ); } close(IN) || die("/usr/sbin/faxinfo: $?"); print < 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 <); close(IN); } print <); close(IN) || die("mimencode: $?"); print <