/usr/share/doc/capi4hylafax/examples/GenerateFileMail.pl is in capi4hylafax 1:01.03.00.99.svn.300-20build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | #! /usr/bin/perl -w
#
# This Script is called by sample_faxrcvd to generate
# a mail with an attached file.
#
# It's based on the hylafax-sample from
# Noel Burton-Krahn <noel@burton-krahn.com>
# (see www.hylafax.org / howto)
#
use strict;
my($fromaddr, $toaddr, $subject, $text, $textdesc, $file, $filemime, $virtfilename, $filedesc) = @ARGV;
my($boundary);
$boundary=join('---',
"=Boundary=",
$$,
sprintf('%x', rand(0xffffffff)));
print <<EOF
From: $fromaddr
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: $textdesc
Content-Transfer-Encoding: 7bit
$text
EOF
;
print <<EOF
--$boundary
Content-Type: $filemime; name="$virtfilename"
Content-Description: $filedesc
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="$virtfilename"
EOF
;
open(IN, "mimencode \"$file\" |") || die ("couldn't mimencode $file: $!");
print while(<IN>);
close(IN) || die("mimencode: $?");
print <<EOF
--$boundary--
EOF
|