Email to Fax Gateway
Hylafax email to fax gateway
One of the main uses for Hylafax is as an email to fax gateway.
This gateway unifies a users communications, so that faxing is as simple as using an email client.
The user can email john@08812345678.fax and know that the message typed, and any attachment will be faxed via Hylafax.
To setup an email to fax gateway using hylafax, a few simple scripts are needed to convert attachments into postscript so that hylafax can then use them. You can send emails with pdf attachments, postscript attachments or tiff attachments.
By default, hylafax will not decode any attachments, so you need to edit
#/etc/hylafax/hyla.conf # This line tells hylafax(faxmail) to decode attachments using scripts # located here. MIMEConverters: /var/spool/hylafax/mimetype #
Create the mimetype directory, then inside that, a directory for the attachment mime type, eg application or image, then create a script inside that. The script is passed $1 as the decoded attachments filename, and hylafax expects postscript on standard out. The tree looks like this
/var/spool/hylafax/mimetype/ /var/spool/hylafax/mimetype/application/pdf /var/spool/hylafax/mimetype/application/ps /var/spool/hylafax/mimetype/image/tiff
The Scripts you will need (make sure to chmod +x them to make them executable):
For PDF attachments
#!/bin/sh #/application/pdf # convert PDF attachment to Postscript for Hylafax to send pdf2ps $1 -
For PS attachments
#!/bin/sh #/application/ps # convert PS attachment to Postscript for Hylafax to send echo $1
For TIF attachments
#!/bin/sh #/image/tif # convert TIF attachment to Postscript for Hylafax to send /usr/bin/tiff2ps $1
For RTF attachments
#!/bin/sh #/application/rtf # convert RTF attachment to Postscript for Hylafax to send /usr/bin/unrtf --html $1 | /usr/bin/html2ps #NOTE that this script does not work! #Although it will work just fine from command line #Hylafax will not accept the Postscript output. #any help is welcome...