HylaFAX The world's most advanced open source fax server

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

[hylafax-users] got a mail gateway for pdf attachments working.



Hello,

I've figured out a setup how to send pdf-attachments from email to the
faxserver. The body of the message itself is ignored.
Attached pdf's in messages with the address 0214312323@pdffax.foo are sent
out via hylafax.

- I use qmail:
I've setup a virtual domain fax with the line:
| pdffax $DEFAULT

in .qmail-default of this domain

pdffax ist a little perl script (please see below - thanx to candid!) It
should be within the home of the owner of this virtual domain. It'a quick
hack  - I'm sure there are better solutions!

greetz

Nik

***********pdffax*************
#!/usr/bin/perl -w
use MIME::Base64;
my $Filename;
my $status;
my $status2;
$to=shift;
       $status=0;
        $status2=0;

while(<STDIN>) {
 if ($_=~ /.*/) {
 # print $_;
 }

 if ($_=~ /filename=\"(.*)\"/) {
  $Filename=$1;
 }

        if ($_=~ /^\-+/) {
        #print "ENDDECODING....";
 $status=0;
 $status2=0;
        }

        if ($status2==2) {
# print "q";
 push @line, $_;

        }

 if ($_=~ /Content-Transfer-Encoding: .ase64/) {
 #print "START DECODING....\n";
 $status=1;
        }

       if ($_=~ /^\s/) {
        #print "START2 DECODING....";

 if ($status==1){
 $status2=2;
 }
        }

}

$encoded = join '', @line;
$decoded = decode_base64($encoded);


open(UT, ">$Filename");
 binmode UT;
 print UT $decoded;
close UT;
qx!sendfax -n -d $to $Filename!;

exit 0;




____________________ HylaFAX(tm) Users Mailing List _______________________
 To unsub: mail -s unsubscribe hylafax-users-request@hylafax.org < /dev/null




Project hosted by iFAX Solutions