Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
— |
freebsd:hylafax [2013/12/16 14:37] (aktuell) idefix angelegt |
||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | ====== Hylafax ====== | ||
+ | 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 | ||
+ | <code> | ||
+ | SendTime: "20:00" | ||
+ | </code> | ||
+ | |||
+ | ===== E-Mail to FAX gateway ===== | ||
+ | ==== Configure faxmail for PDF attachments ==== | ||
+ | Edit /usr/local/lib/fax/hyla.conf | ||
+ | <code> | ||
+ | # 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 | ||
+ | </code> | ||
+ | |||
+ | Create the MIME conversion tools: | ||
+ | <code> | ||
+ | mkdir /usr/local/faxscripts | ||
+ | mkdir /usr/local/faxscripts/application | ||
+ | </code> | ||
+ | |||
+ | Create the file /usr/local/faxscripts/application/pdf | ||
+ | <code> | ||
+ | #!/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 | ||
+ | </code> | ||
+ | |||
+ | Create the file /usr/local/faxscripts/filter.pl | ||
+ | <code> | ||
+ | #!/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]; | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ | Give both file the executable bit | ||
+ | <code> | ||
+ | chmod +x /usr/local/faxscripts/application/pdf | ||
+ | chmod +x /usr/local/faxscripts/filter.pl | ||
+ | </code> | ||
+ | |||
+ | Now conversion to postscript should be possible. Take an email with a pdf attachment and save it under testmail.mail. Now execute the command: | ||
+ | <code> | ||
+ | cat testmail.mail|faxmail -v >test.ps | ||
+ | </code> | ||
+ | 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: | ||
+ | <code> | ||
+ | domainlist fax = <; fax | ||
+ | </code> | ||
+ | |||
+ | Add at the section routers: | ||
+ | <code> | ||
+ | fax: | ||
+ | driver = manualroute | ||
+ | transport = fax | ||
+ | route_list = fax | ||
+ | </code> | ||
+ | |||
+ | Add at the section transports: | ||
+ | <code> | ||
+ | fax: | ||
+ | driver = pipe | ||
+ | user = idefix | ||
+ | command ="/usr/local/bin/faxmail -n -d ${local_part}" | ||
+ | home_directory = /usr/local/bin | ||
+ | </code> | ||
+ | |||
+ | ==== Sending a fax ==== | ||
+ | Now send an email to the address | ||
+ | <code> | ||
+ | <number>@fax | ||
+ | </code> | ||
+ | replace <number> with the fax number. | ||
+ | |||
+ | The fax is now scheduled, you can check this with the command: | ||
+ | <code> | ||
+ | faxstat -l -s | ||
+ | </code> | ||