#! /usr/bin/perl -w # # /var/spool/fax/bin/faxrcvd-mail # Noel Burton-Krahn # Sept 4, 1999 # # Modifications by Jonas Smedegaard # 2001-2002 # # $Id: faxrcvd-mail,v 1.2 2002-03-07 16:22:51 jonas Exp $ # # a replacement for hylafax's faxrcvd which sends the whole fax by email # use strict; my($filebase, $filetype, $device, $commid, $msg, $toaddr, $fromaddr, $sentaddr) = @ARGV; if( !defined $fromaddr ) { die("Usage: faxrcvd-mail []") }; if( !defined $sentaddr ) { $sentaddr="" }; open(STDOUT, "|/usr/sbin/sendmail -oi -f$fromaddr $toaddr") || die("/usr/sbin/sendmail -oi -f$fromaddr $toaddr: $!"); my(%info, $info); my($boundary); $boundary=join('---', "=Boundary=", $$, sprintf('%x', rand(0xffffffff))); open(IN, "/usr/sbin/faxinfo $filebase.tif|") || die("/usr/sbin/faxinfo $filebase.tif: $!"); while() { $info .= $_; $info{lc($1)} = $2 if( /^\s*(\S+): (.*)$/ ); } close(IN) || die("/usr/sbin/faxinfo: $?"); my($subject) = "FAX from $info{sender}"; if( $sentaddr ne "" ) { $subject .= " (dispatched to $sentaddr)" }; print < To: $toaddr Subject: $subject 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 File on host is: $info EOF ; if( $msg ne "" ) { print <); close(IN) || die("mimencode: $?"); next; }; /^ps$/ and -f "$filebase.ps" and do { print <); close(IN) || die("mimencode: $?"); next; }; /^tif$/ and -f "$filebase.tif" and do { print <); close(IN) || die("mimencode: $?"); next; }; # default: output the tif file die "Unsupported filetype \"$filetype\"!"; } if( open(IN, "); close(IN); } }; # end of part possibly dispatched print <includemode:
authorJonas Smedegaard <dr@jones.dk>2023-06-27 09:35:08 +0200
committerJonas Smedegaard <dr@jones.dk>2023-06-27 09:35:08 +0200
commitfd54908da2b05c526dd3bee9b6dcd093214a220d (patch)
treec69c845069c99d1d01044f6fafda7c08433329c6 /tags/5c/3f/20140702064024.GD1546@sid.nuvreauspam/unread
parentba46132213560cf3335d53560d519c0ec0190da2 (diff)
Diffstat (limited to 'tags/5c/3f/20140702064024.GD1546@sid.nuvreauspam/unread')
-rw-r--r--tags/5c/3f/20140702064024.GD1546@sid.nuvreauspam/unread0
1 files changed, 0 insertions, 0 deletions