email2faxthumpThis is an awasome feature of hylafax. User can send fax using email applications. Ex: riyesh@23656237.fax

We need to add some simple scipts to activate this feature.By defult hylafax will not decode the attachments.So you need to edit /etc/hylafax/hyla.conf.

specify mime type directory location in /etc/hylafax/hyla.conf

add the following line

MIMEConverters: /var/spool/hylafax/mimetype

Then create the converting scripts under /var/spool/hylafax/mimetype

mkdir /var/spool/hylafax/mimetype

you need to create followin directories under /var/spool/hylafax/mimetype

mkdir application

mkdir image

mkdir text

the tree look like this

/var/spool/hylafax/mimetype/
/var/spool/hylafax/mimetype/application/pdf
/var/spool/hylafax/mimetype/application/ps
/var/spool/hylafax/mimetype/image/tiff

/var/spool/hylafax/mimetype/text/html

For msword type of files create msword under /var/spool/hylafax/mimetype/application/

cd /var/spool/hylafax/mimetype/application/

touch msword

chmod +x  msword

vi msword

add the following lines in msword script

#!/bin/bash
antiword $1
exit

For PDF type of files create pdf under /var/spool/hylafax/mimetype/application/

cd /var/spool/hylafax/mimetype/application/

touch pdf

chmod +x pdf

vi pdf

add the following lines in pdf script

#!/bin/sh
#/application/pdf
# convert PDF attachment to Postscript for HylaFAX to send
pdf2ps $1 -
# if you want to send multipage pdf attachments it is better to use “pdftops”
# use the line below instead of “pdf2ps $1 -”
# /usr/bin/pdftops $1 -


For postscript type of files create postscript under /var/spool/hylafax/mimetype/application/

cd /var/spool/hylafax/mimetype/application/

touch postscript

chmod +x postscript

vi postscript

add the following lines in postscript script

#!/bin/sh
#/application/pdf
# convert PDF attachment to Postscript for HylaFAX to send
pdf2ps $1 -
# if you want to send multipage pdf attachments it is better to use “pdftops”
# use the line below instead of “pdf2ps $1 -”
# /usr/bin/pdftops $1 -
mail:/var/spool/hylafax/mimetype/application #
mail:/var/spool/hylafax/mimetype/application # cat postscript
#!/bin/sh
#/application/ps
# convert PS attachment to Postscript for HylaFAX to send
echo $1

For PS attachment files create ps under /var/spool/hylafax/mimetype/application

cd /var/spool/hylafax/mimetype/application/

touch postscript

chmod +x postscript

vi postscript

add the following lines in ps script

#!/bin/sh
#/application/ps
# convert PS attachment to Postscript for HylaFAX to send
echo $1

For rtf attachement files create rtf under /var/spool/hylafax/mimetype/application

cd /var/spool/hylafax/mimetype/application/

touch rtf

chmod +x rtf

vi rtf

add the following lines in rtf

#!/bin/sh
#/application/rtf
# convert RTF attachment to Postscript for HylaFAX to send
/usr/bin/unrtf –html $1 | /usr/bin/html2ps

For jpeg attachment files create jpeg under /var/spool/hylafax/mimetype/image

cd /var/spool/hylafax/mimetype/image

touch image

chmod +x image

vi image

add the following lines in jpeg

#! /bin/sh
/usr/bin/jpeg2ps  $1
exit

For tiff attachment files create tiff under /var/spool/hylafax/mimetype/image

cd /var/spool/hylafax/mimetype/image

touch tiff

chmod +x tiff
vi tiff

Then add the following lines

#! /bin/sh
/usr/bin/jpeg2ps  $1
exit
mail:/var/spool/hylafax/mimetype/image # cat tiff
#!/bin/sh
#/image/tif
# convert TIF attachment to Postscript for HylaFAX to send
/usr/bin/tiff2ps $1
# if you want to send multipage tiff images, than you have to add the option “-a”
# for example:
#/usr/bin/tiff2ps -a $1

For HTML type  files create html under /var/spool/hylafax/mimetype/text

cd /var/spool/hylafax/mimetype/text

touch html

chmod +x html
vi html

then add the following lines.

#! /bin/sh
/usr/bin/html2ps   $1
exit

Integrating with MTA’s


cd /usr/src/hylafax-(source package)

cd faxmail

there you can see the files

mailfax.sh-sendmail

mailfax.sh-postfix

mailfax.sh-qmail

mailfax.sh-smail

do as per the files says.