All,
Forgot the instructions on the mailfax script, after that the system responded very well. I will do a clean install tomorrow and see what I get.
Thanks to ALL and I mean all of ya! You are the best!
Carl
I tested this 3 times with a clean install.
Hylafax on the SME Server 1/29/07
These instructions will install Hylfax on the SME Server version 7.1 as of 1/29/07.
The system will send a fax and e-mail the faxuser.
Download the most current version from here and place the file in the /usr/sbin folder.
# cd /usr/sbin
# wget
ftp://ftp.hylafax.org/binary/linux/redhat/RPMS/i386/hylafax-4.3.1-1rhel4.i386.rpmInstall via the following command and it will install all of the required packages for you.
# yum --enablerepo=base --enablerepo=updates localinstall hylafax-4.3.1-1rhel4.i386.rpm
Make sure that your modem is plugged into the serial port and turned on.
After the install, the system will ask you to reboot the system, then run the
# /usr/sbin/faxsetup command and answer the questions as required.
NOTE: When I answered the questions, I accepted the defaults on most everything except
the area code and telephone number of the fax line.
Take note of your modems tty and substitute within the inittab template to suit your setup. My modem is on ttyS0. (The first serial port is ttyS0 and the second is ttyS1) Internal Modems most likely will not work.
Run the following commands. Watch out for line wrapping.
# mkdir -p /etc/e-smith/templates-custom/etc/inittab
# cd /etc/e-smith/templates-custom/etc/inittab
# echo 'fax:23457:respawn:/usr/sbin/faxgetty ttyS0' >> 85hylafax
# /sbin/e-smith/expand-template /etc/inittab
# ln -s /etc/rc.d/init.d/hylafax /etc/rc.d/rc7.d/S95hylafax
# signal-event post-upgrade; signal-event reboot
Setting up SME-Server using the server manager
Open your server-manager.
Create a new user account using the following data:
Account Name: faxuser
First Name: fax
Last Name: fax
E-Mail Delivery: Deliver e-mail locally
Forwarding Address: Leave Blank
Reset Password <9Gh08pV5O;
Create a new virtual domain:
Domain Name: fax
Brief Description: fax
Content: Primary Web Site
Domain DNS Servers Resolve Locally
*************************************************************
Changing SME-Server configuration
Next step is to redirect all mail for the domain .fax to the user faxuser.
We can do this by creating a custom template file in the appropriate folder.
Create the folder (if it doesn’t already exist).
# mkdir -p /etc/e-smith/templates-custom/var/qmail/control/virtualdomains
Create the custom template file.
# pico /etc/e-smith/templates-custom/var/qmail/control/virtualdomains/95faxmail
In this 95faxmail file we will enter the virtual domain, and connect it to the faxuser.
The only line in this file will look like this:
.fax:faxuser
Redirect mail for faxuser to mailfax script.
We will create a new file that tells qmail to pipe all mail to the (to be created) mailfax script.
In the users home directory /home/e-smith/files/users/faxuser. We create and edit the file
named .qmail-default:
# pico /home/e-smith/files/users/faxuser/.qmail-default
Containing only one line
| /etc/hylafax/etc/mailfax
Set the ownership and rights on .qmail-default to the user only:
# chown faxuser:faxuser /home/e-smith/files/users/faxuser/.qmail-default
# chmod 644 /home/e-smith/files/users/faxuser/.qmail-default
Restart the qmail Server.
First we'll have to rebuild the configuration files. Then we can restart qmail.
Rebuild the SME-Server configuration files by executing:
# /sbin/e-smith/signal-event console-save
This can take awhile, after that we restart qmail:
# service qmail restart
Creating the mailfax script
# pico /etc/hylafax/etc/mailfax
This file must contain:
#!/bin/sh
#
# mailfax - email to fax gateway for qmail.
#
# Original file from HylaFAX, updated for e-smith server.
#----------------------------------------------------------
# 4 more information see:
http://www.vangee.nl/sme/hylafax#
# 1.) Install HylaFAX
# 2.) In server-manager add a virtual domain named: fax
# 3.) In server-manager add a user named: faxuser
# 4.) Install this file as: /etc/hylafax/etc/mailfax
# 5.) Add the following file to your system:
# /etc/e-smith/templates-custom/var/qmail/control/virtualdomains/90aliases
# 6.) Put this line in the file:
# .fax:faxuser
# 7.) Add the following file to your system:
# /home/e-smith/files/users/faxuser/.qmail-default
# 8.) Put this line in the file:
# | /etc/hylafax/etc/mailfax
# 9.) Execute: /sbin/e-smith/signal-event console-save
# 10) Execute: service qmail restart
TMPVAR=${SENDER//\`/}
TMPVAR=${TMPVAR//\$\(/}
SENDER=${TMPVAR//\)/}
/usr/bin/faxmail -f Helvetica-Bold | /usr/bin/sendfax \
-f "$SENDER" \
-n -d "$EXT2@`/usr/bin/expr \"$HOST\" : '\(.*\)\.fax$'`"
Change the ownership and rights for the mailfax script:
# chown root:root /etc/hylafax/etc/mailfax
# chmod 755 /etc/hylafax/etc/mailfax
Add the following file to your system:
Receiving faxes by e-mail
We can also route all incoming faxes to the faxuser's e-mail box. To do this we must create a new
HylaFAX configuration file. It is possible to receive the incoming faxes in one of three formats. (.ps .pdf or .tif)
# pico /var/spool/hylafax/etc/FaxDispatch
This file must contain:
FILETYPE=pdf;
SENDTO=faxuser;
Substitute tif or ps for pdf as you desire.
+++++++++++++++++++++++++++++++++++++++++++++++
Hylafax e-mail to Fax Gateway
One of the main uses for Hylafax is as an e-mail to fax gateway. This gateway unifies a users
communications, so that faxing is as simple as using an e-mail client. The user can e-mail
john@08812345678.fax and know that the message typed, and any attachment will be faxed via Hylafax.
To setup an e-mail 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 e-mails with pdf attachments, postscript attachments or tiff attachments. By default, hylafax will not decode any attachments, so you need to edit
Run the following commands.
# pico /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
# cd /var/spool/hylafax
# mkdir /var/spool/hylafax/mimetype
# mkdir /var/spool/hylafax/mimetype/application pdf file goes here ps file goes here
# mkdir /var/spool/hylafax/mimetype/image tiff file goes here
+++++++++++++++++++++++++++++++++++++++++++++++
For PDF attachments:
cd /var/spool/hylafax/mimetype/application
pico pdf
Insert this code below in the pdf file;
#!/bin/sh
#/application/pdf
# convert PDF attachment to Postscript for Hylafax to send
pdf2ps $1 –
Save the file.
# chmod +x pdf
For PS attachments:
pico ps
Insert this code below in the ps file;
#!/bin/sh
#/application/ps
# convert PS attachment to Postscript for Hylafax to send
echo $1
Save the file.
# chmod +x ps
For TIF attachments:
cd /var/spool/hylafax/mimetype/image/
pico tif
Insert this code below in the tif file;
#!/bin/sh
#/image/tif
# convert TIF attachment to Postscript for Hylafax to send
/usr/bin/tiff2ps $1
Save the file.
# chmod +x tif
(make sure to chmod +x them to make them executable).
# signal-event post-upgrade; signal-event reboot
Testing
Send an e-mail from your favorite mailing software to the SME-Server. This means that the smtp server in your e-mail software must be set to the SME-Server. Because the e-mail address we are going to be using will only be known by our server. Then we will send an e-mail with the following recepeint: Name@FaxNumber.fax
e.g: John_Smith@5555551212.fax
+ The name can be any name.
+ The fax number is going to be used for faxing the document.
+ Mail can only be send as a plain text e-mail.
+ Mail can have a postscript attachment, this attachment will also be faxed. (filename.ps)
So don't expect your html formatted e-mails to be faxed! Sorry!