XFAX 4.3a - User's Guide
9. XFAX and e-mail
XFAX can be used, to advantage, as a fax gateway in a system for electronic mail. By addressing your letters in a special way you can send both fax and electronic mail from one and the same program, the mail client.
Described below how this functionality is set into sendmail that is the most common program for routing mail in the UNIX environment. Sendmail is a so-called MTS, Message Transfer Agent, which takes care of incoming and outgoing messages and ensures that they are passed on in the correct way.
You begin by deciding on a standard for how mail to the fax gateway should be addressed. Below we use an example domain which is known as infoflex.se and assume that one machine acts as both mail and fax gateway. Let us say that the machine is known as gw.
There are various options for addressing, two of which can be <faxno>.firstname.lastname@example.org and <faxno>@fax.infoflex.se. In the latter example it is necessary that any name servers in the network can handle fax.infoflex.se and steer on this mail to gw.infoflex.se. We have also presupposed that gw.infoflex.se lies hidden behind infoflex.se in the first example.
Below we use the first example since this does not require any changes to any name servers.
The configuration file for sendmail is known as sendmail.cf and is generally to be found under /etc or /usr/lib. Furthermore, we presuppose that the software is installed so that BINDIR is /usr/local/xfax/bin and that ETCDIR is /usr/local/xfax/etc. A tip is to copy sendmail.cf to e.g. sendmail.xfax and then make the changes in this. After having verified that the new rules, which have been added, function as they should, you can move sendmail.xfax to sendmail.cf and run the whole thing distinctly. All this is done in order to avoid disturbing traffic in progress as little as possible.
The first thing to do is to create a new delivery method in sendmail for faxes by setting up a new delivery handler, or delivery agent. Adding a line, most suitably close to the other definitions for delivery handlers as shown below does this.
Mxfax, P=/usr/local/xfax/bin/faxmail, F=lsDFM, S=10, R=20, A=faxmail $u
The above line defines a new delivery agent xfax which, when used, forwards the message to a new program, or shell script, which is known as faxmail and is to be found under /usr/local/xfax/bin. In the XFAX distribution there is an example of how such script can appear. Study this carefully. As an argument to this program a user name will be sent in. In our case this user name will be the fax number to our recipient.
Step two is now to set up a rule that says when the delivery agent we have defined above should be used. It can appear as follows:
This rule should be placed in the rule set up, ruleset, SO and states that all mail to *email@example.com should be sent on to the delivery agent xfax. Before rule SO is used another rule, S3 will be used. This rule normally adds "<>" around the domain part of the address which explains that above there is R$+.fax<@infoflex.se> and not R$..firstname.lastname@example.org. $:$1 above shows that the user name should be added to that which stands before .fax, in our case the fax number.
Note. Sendmail, which is often run as root, must have locking and evacuation rights to the script faxmail. Furthermore, the first line in faxmail, presupposing that faxmail is a Bourne-shell script, reads:
in order that it should be executed correctly.
Now we can test that the rule works.
This is most suitably done by running sendmail in the test position by starting sendmail with the parameter -bt. If we use the temporary configuration file sendmail.xfax we must also indicate this to sendmail.
# sendmail -Csendmail.xfax -bt
When we execute the command we obtain a prompt. There we write in:
Check that the mail is in a queue in XFAX. If this does not work it is only necessary to write out the log message at a strategic place in faxmail. Note that you can use the special shell variable $? which always contains the return code for the command last executed.
Set up any cover sheet, address filter to prevent unauthorized people using it etc in faxmail.
There are example lines for sendmail.cf in the file sendmail.data under ETCDIR:
9.2 The script faxmail
Faxmail is the script that takes care of the addresses and the letter data that comes from sendmail. The script that is supplied with the XFAX distribution is to be seen as a relatively complete example of how faxmail should function. However, a certain amount of manual adaptation is needed in order to adapt the script to the specific customer environment.
In faxmail you can choose to deal with the following: