Hylafax

Dec 16, 2013
2 min read
May 27, 2023 09:13 EEST

Seems to be broken with newer versions… Use mgetty+sendfax instead.

Send fax after a defined time

To send all faxes after 20:00 edit /usr/local/lib/fax/sendfax.conf

SendTime: "20:00"

E-Mail to FAX gateway

Configure faxmail for PDF attachments

Edit /usr/local/lib/fax/hyla.conf

# FontMap/FontPath added by faxsetup (Thu Feb  2 14:32:10 CET 2006)
FontMap:   /usr/local/share/ghostscript/7.07/lib:/usr/local/share/ghostscript/fonts
FontPath:  /usr/local/share/ghostscript/7.07/lib:/usr/local/share/ghostscript/fonts
PageSize: ISO A4
MIMEConverters: /usr/local/faxscripts

Create the MIME conversion tools:

mkdir /usr/local/faxscripts
mkdir /usr/local/faxscripts/application

Create the file /usr/local/faxscripts/application/pdf

#!/usr/local/bin/bash
/bin/echo " "
/bin/echo "showpage"
/usr/local/bin/gs -q -sPAPERSIZE=a4 -dFIXEDMEDIA -dBATCH -dNOPAUSE -r600x800 -sDEVICE=pswrite -sOutputFile=- $1 | /usr/local/faxscripts/filter.pl

Create the file /usr/local/faxscripts/filter.pl

#!/usr/bin/perl
# Read from the standard input
@text=<STDIN>;
$size=@text;

# Count the number of "showpage"
$count=0;
for($i=0;$i<=$size;$i++){if($text[$i] =~ /showpage/){$count++;}}

# Discard the last line that contain "showpage"
$num=1;
for($i=0;$i<=$size;$i++){
        if($text[$i] =~ /showpage/){
                if($num!=$count){$num++;}
                else{$text[$i]=~s/showpage//g;}
        }

                print $text[$i];
}

Give both file the executable bit

chmod +x /usr/local/faxscripts/application/pdf
chmod +x /usr/local/faxscripts/filter.pl

Now conversion to postscript should be possible. Take an email with a pdf attachment and save it under testmail.mail. Now execute the command:

cat testmail.mail|faxmail -v >test.ps

Check the output from faxmail at screen and have a look at test.ps and verify that it was a successfully conversion.

Configure Exim

Add a new domain_list for faxes:

domainlist fax = <; fax

Add at the section routers:

fax:
   driver = manualroute
   transport = fax
   route_list = fax

Add at the section transports:

fax:
  driver = pipe
  user = idefix
  command ="/usr/local/bin/faxmail -n -d ${local_part}"
  home_directory = /usr/local/bin

Sending a fax

Now send an email to the address

<number>@fax

replace with the fax number.

The fax is now scheduled, you can check this with the command:

faxstat -l -s

Related Posts