AsterFax the Email to Fax Gateway for Asterisk.
---------------   We have moved -----------------

AsterFax and Asterisk IT have both been renamed.

Asterfax is now known as Noojee Fax

Asterisk IT is now known as Noojee Telephony Solutions.

Noojee Fax documentation and support can now be obtained via:

---------------   We have moved -----------------

Asterisk IT is the primary developer and sponsor of AsterFax the Open Source Email to Fax Gateway for Asterisk.
Asterisk I.T. offer a range of support options for AsterFax as well as general Asterisk consulting services.  Contact for more information.
You can also receive support from the Asterfax and Asterisk communities by by posting at the relevant forum.

AsterFax - Asterisk Fax Logo

Configuring AsterFax to work with Sendmail

The following principles (but not the detail) can be applied to any mail server not just sendmail.

The ideal AsterFax configuration is to have you existing mail server accept mail on behalf of AsterFax. The primary benefit of this is that your users don't have to reconfigure their mail client in order to send a fax.

Sendmail with procmail

Thanks to Robert Moskowitz for his contribution on using procmail with sendmail:


One IP, two host names:


sip is in DNS as an A RR and fax as a CNAME.

Note: this setup might not be right for sip.domain to recieve mail. But right now, it seems to only need to send it.

fax.domain procmail:/etc/procmailrc

fax.domain RELAY

required_hits 5
report_safe 0

Procmail contribution (spam to maildir format):
| /usr/bin/spamassassin
* ^X-Spam-Status: Yes

Use /dev/nul to throw spam out

Procmail (fax to maildir format):
* ^(To|Cc|Bcc).*

Note that since the maildir format is used here, the emails are actually in


I will be refining my procmail.


Thanks to Levente Farkas for his contribution on configuring postfix:

1. create a CNAME in your dns to the asterisk servers as:
faxserver CNAME asterisk

2. in /etc/postfix/
mydestination = $myhostname, localhost.$mydomain, localhost,
virtual_maps = hash:$config_directory/virtual

3. in /etc/postfix/virtual add this line:
------------------------------------ faxserver

4. in /etc/aliases add this line:
faxserver: /var/spool/asterfax/inbox/

5. in /usr/lib/asterfax/config/AsterFax.xml modify this line:
External ... /var/spool/asterfax/inbox/new ------------------------------------ Now send mail to and AsterFax should process it.


Thanks to Woolitel for his contribution on Exim4 configuration for AsterFax.
HowTo configure exim4 under Debian to store faxes in the file /var/spool/asterfax/inbox/new:

First step to configure exim4 :

dpkg-reconfigure exim-4
Split configuration into small files? => Yes
General type of mail configuration: => internet site; mail is sent and received directly using SMTP
System mail name: => pbx.loc
IP-addresses to listen on for incoming SMTP connections: =>
Other destinations for which mail is accepted: => fax.loc
Domains to relay mail for: =>
Machines to relay mail for: => ( your local subnet )
Keep number of DNS-queries minimal (Dial-on-Demand)? => No

Create file :
With :
debug_print = "T: appendfile to fax spool"
driver = appendfile
file = /var/spool/asterfax/inbox/new
user = mail
mode = 0770

Create file :

debug_print = "R: Fax spool"
driver = accept
domains = fax.loc
transport = fax_spool

Restart exim4 :
/etc/init.d/exim4 restart

So the basic principle is to configure your mail server to relay mail to AsterFax. The key word here is 'relay'. Due to SPAM issues most mail servers (make that all of them) are configured not to relay mail.

This technique effectively makes AsterFax a zero install and zero configuration at the client.

How you configure your mail server all depends on how you want users to enter the 'To' address when sending a fax.
The standard recommendation is to use the domain 'fax.local', however you could also use a domain such as ''.

Just replace fax.local in the following examples with your chosen domain name.

Assuming you are using sendmail all you need to do to relay the whole fax.local domain  in sendmail is to use
the "mailertable". The standard /etc/mail/ on most distributions (including Centos) will include this.

The file to add entrees is : /etc/mail/mailertable.

The format of an entry is:
<domain> <transport> : [ <target fqdn or ip that this domains email has to be sent to> ]

So for the domain fax.local the required entry is:

fax.local smtp:[fax.local]

The thing to note here is the square brackets around the target host.
These mean that the MTA will ignore MX records. If the target is an IP address, no entry in Dns is required if the square brackets are in place.

If you use a host name as above you will need to create either a DNS or a host entry so that (for the above example) fax.local can be resolved to an ip address.
The simplest method is to create an entry in the /etc/host file. Note: this needs to be done on the sendmail server.
Create an entry similar to the following where the IP address is the IP address of the server AsterFax is running on.    fax.local

Running Sendmail and AsterFax on the same machine

If AsterFax and sendmail are running on the same server you need to do some extra work. As both sendmail and AsterFax listen on port 25 they will get in each others way unless you make some adjustments.
The simplest way of resolving the problem is to add a second IP address to you asterisk server and have AsterFax listen on that address.

[I'm assuming here that you have previously reconfigured sendmail so that it isn't listening only on localhost].

You need to edit the AsterFax configuration file /usr/lib/asterfax/config/AsterFax.xml.
Find the nested element <InBound><SMTP><Host> and modify the host to be the selected IP address.

Start by confirming your existing IP address by typing:

As an example lets say that your current IP address is

To add a second address to your network card you need to know an available network address and its subnet mask (consult your network administrator). Assuming the address is available and its netmask is and the interface name is eth0, then create a new ifcfg file which will create a virtual interface with a second IP address.

If you have a gui installed then run netconfig and its pretty straight forward otherwise you can do the following:
The following instructions apply to Centos 4.2 (asterisk@home)
I found this article useful:

Create a new file (substitute eth0 for what ever device you wish to modify)

Add the following lines (again substitute eth0 for the appropriate device).
Once down, reboot your system to make the changes take affect.

Once the system comes up check that you have two ip addresses by running:

ifconfig eth0
ifconfig eth0:1

You then need to configure sendmail to only listen on the address rather than all addresses.
This can be accomplished by modifying your /etc/mail/ file.

Add the following line (check that a similar one doesn't already exist).

Once you have added the required line you will need to recompile as follows:

First install the sendmail-cf package (if you don't already have it) using:
yum install sendmail-cf

Now compile the modified file:
m4 /etc/mail/ > /etc/mail/

Finally restart sendmail.
service sendmail stop
service sendmail start

You can now check what ip addresses sendmail is listening on by running:
netstat -na

you should see a line similar to :
tcp 0 0* LISTEN

Restart Asterfax.

You can now send faxes using your standard email client without any modifications.

Note: AsterFax is not a secure SMTP gateway so please ensure that its MX record is not visible externally. Your external smtp server should also be configured to not accept faxes for the domain fax.local.

AsterFax UserGuide
Configuring Email Clients
Supported File Formats
Installing AsterFax
Configuring AsterFax
Testing AsterFax
Trouble Shooting AsterFax
Running AsterFax
Configuring SendMail
Configuring GhostScript
Configuring OpenOffice
Add your own File format

AsterFax is Sponsored by Asterisk I.T.
©2006  Asterisk I.T. all rights reserved. Some parts of this site may be the copyright of other authors. If you want to copy parts of this page you may do so provided you have gained permission from Asterisk I.T. first. Email
AsterFax™ is a trade mark of Asterisk I.T..
I'm not a great believer in Trade Marking Open Source software but unfortunately someone has been running a scam to redirect traffic to a bogus AsterFax web site. As such I've trade marked AsterFax's name to provide protection from such people.