Postfix Frequently Asked Questions


Up one level | Postfix FAQ

Table of contents


Running Postfix inside an intranet

The simplest way to set up Postfix on a host inside a firewalled network is to send all your mail to the intranet mail gateway, and to let that gateway take care of forwarding.


Running Postfix on a firewall

Note: this section depends on accidental properties of the implementation so this information is subject to change.

How to set up Postfix on the firewall machine so that it relays mail for my.domain to a gateway machine on the inside, and so that it refuses mail for *.my.domain? The problem is that the standard relay_domains mail relaying restriction allows mail to *.my.domain when you specify my.domain.

Unfortunately, the solution cannot use the transport table, because that table is ignored for destinations that match $mydestination. That's an implementation error, and it will be removed.


Running Postfix on a dialup machine


Delivering some users locally while sending mail as user@domain


Address masquerading with exceptions

For people outside your organization it can be desirable to only see addresses of the form user@company.com rather than addresses with individual internal host names. This can be achieved with address masquerading.

Address masquerading is intended for use only on mail gateways.

In some cases, you may wish to have certain users or hosts exempted from masquerading.

As usual, execute the command postfix reload to make the changes effective.


Support for virus scanning

Would not it be great if operating systems and applications actually worked the way they are supposed to, instead of being as fragile as today's products? Well, we can solve only one problem at a time.

Currently, Postfix has no hooks to let other programs inspect every message, so the scanning has to be done before mail enters Postfix or while mail leaves Postfix, for example at mailbox delivery time.

Examples:
mailbox_command = /some/program ...
specifies a command that runs whenever mail is delivered to mailbox. See the sample main.cf file for examples. In /etc/aliases, you must specify an alias for root that directs mail to a real person, otherwise funny things happen with mail sent to root.

mailbox_transport = foo
delegates local mailbox delivery to the transport foo as configured in /etc/postfix/master.cf. If you follow this route you will build something around the pipe mailer. See examples in master.cf.

Support for maildir-style mailboxes

Maildir is a specific one-file-per-message organization that was introduced with the qmail system by Daniel Bernstein.

Postfix supports the maildir mailbox format. Edit main.cf and specify a line with: home_mailbox = Maildir/ (any relative pathname that ends in / will do).

The maildir format is also supported for delivery from aliases or .forward files. Specify /file/name/ as destination. The trailing / turns on maildir delivery.


Using Procmail for local delivery

Postfix exports information via environment variables. The contents are censored. Any characters that may have special meaning to the shell are replaced by underscores.

DOMAIN
The text to the right-hand side of the @ in the recipient address.
EXTENSION
Optional address extension part.
HOME
The recipient's home directory.
LOCAL
The text to the left-hand side of the @ in the recipient address, for example, $USER+$EXTENSION.
LOGNAME
The recipient username.
RECIPIENT
The entire recipient address, $LOCAL@$DOMAIN.
SHELL
The recipient's login shell.
USER
The recipient username.

Postfix breaks "sendmail -v"

Some people will complain that sendmail -v no longer shows the actual mail delivery.

With a distributed mail system such as Postfix, this is difficult to implement. Postfix does not run any mail delivery process under control by a user. Instead, mail delivery is done by daemon processes that have no parental relationship with user processes. This eliminates a large variety of potential security exploits with environment variables, signal handlers, and with other process attributes that UNIX passes on from parent to child.

In addition, Postfix uses multiple processes in order to insulate subsystems from each other. Making the delivery agents talk directly to user processes would defeat a lot of the effort that went into making Postfix more secure than ordinary mailers.


Getting rid of Delivered-To:

Some people will complain about the ugly Delivered-To: message header that Postfix prepends to their mail. By default, Postfix prepends this header when forwarding mail, and when delivering to file (mailbox) or command. The purpose is to stop mail forwarding loops as early as possible, that is, before they have a chance to happen. But the header is ugly, no question about it.

Solutions, ranging from fighting symptoms to turning off the Delivered-To: header:

See also the FAQ item for problems with the majordomo approve command.


Postfix breaks the majordomo "approve" command

The Postfix local delivery agent prepends a Delivered-To: message header to prevent mail forwarding loops. With majordomo mailing lists, Delivered-To: gets in the way when the moderator wants to approve postings that were sent to the list. The Postfix system claims that the mail is looping.

Currently, the workaround is to edit the approve script to strip any header lines that match:

/delivered-to/i

Yes, this assumes that the moderator knows what she is doing.


Setting up an Internet to UUCP gateway

Here is how to set up a machine that sends some but not all mail via UUCP. See the UUCP-only FAQ entry for setting a UUCP-only host.


Using UUCP as the default transport

Here is how to relay all your mail over a UUCP link. See the Internet to UUCP FAQ entry for setting up a machine that gateways between UUCP and SMTP.


Sending mail to a FAX machine

The following information is by Joerg Henne:

Over here we are using the scheme @fax.our.domain with Postfix and HylaFax. Here's the setup used:

In master.cf:

    fax       unix  -       n       n       -       -       pipe
	flags= user=fax argv=/usr/bin/faxmail -d -n ${user}

In the transports map:

    fax.your.domain   fax:localhost

Note: be sure to not advertise fax.your.domain in the DNS...


Mail fails with timeout or lost connection

Occasionally, mail fails with "timed out while sending end of data -- message may be sent more than once", or with: "lost connection after DATA". Network outages happen, systems crash. There isn't much you can do about it.

However, when you see mail deliveries fail consistently, you may have a different problem: broken path MTU discovery.

A little background is in order. With the SMTP protocol, the HELO, MAIL FROM and RCPT TO commands and responses are relatively short. When you're talking to sendmail, every command and every response is sent as a separate packet, because sendmail cannot implement ESMTP command pipelining.

The message content, however, is sent as a few datagrams, each datagram typically a kbyte large or even bigger, depending on your local network MTU.

When mail fails consistently due to a timeout, I suspect that the sending machine runs a modern UNIX which implements path MTU discovery. That causes the machine to send packets as large as it would send over the LAN, with the IP DONT'T FRAGMENT bit set, preventing intermediate routers from fragmenting the packets that are too big for their networks.

Depending on what network path a message follows, some router on the way responds with an ICMP MUST FRAGMENT message saying the packet is too big. Normally, the sending machine will re-send the data after chopping it up into smaller pieces.

However, things break when some router closer to the sending system is dropping such ICMP feedback messages, in a mistaken attempt to protect systems against certain attacks. In that case, the ICMP feedback message never reaches the sending machine, and the connection times out.

This is the same configuration problem that causes trouble with web servers behind a misconfigured packet filter: small images/files are sent intact, large images/files time out because the server does not see the MUST FRAGMENT ICMP feedback messages.

Workaround: disable path MTU discovery at the sending machine. Mail will get out, but of course everyone else will still suffer. How to disable path MTU discovery? It depends. Solaris has an ndd command; other systems use different means such as sysctl to control kernel parameters on a running system.

Fix: find the router that drops the ICMP MUST FRAGMENT messages, and convince the person responsible for it to fix the configuration.


Undefined symbols: ___dn_expand, ___res_init etc.

Question: When I build Postfix I get the following errors:

    ld: Undefined symbol
       ___dn_expand
       ___res_init
       ___res_search
    *** Error code 1

Answer: you're mixing BIND version 8 include files with a different version of the resolver library.

Fix: use the right include files. For example:

    make makefiles CCARGS="-I/usr/include".

Using DB libraries on Solaris etc.

The old dbm UNIX database has severe limitations when you try to store lots of information. It breaks when the number of hash collisions becomes so large that the entries no longer fit together in a single disk block. The more modern db database does not suffer these limitations. It is standard on 4.4BSD and Linux systems.

In order to build Postfix with db support on UNIX systems that do not have db support out of the box, you need the db-1.85 release, or the current version which has a db-1.85 compatible interface.

Use the following commands in the Postfix top-level directory. The LD_LIBRARY_PATH unset commands may be required to avoid linking in the wrong libraries.

% LD_LIBRARY_PATH=   (Bourne-shell syntax)
% unsetenv LD_LIBRARY_PATH   (C-shell syntax)
% make tidy
% make makefiles CCARGS="-DHAS_DB -DPATH_DB_H='<db_185.h>' -I/some/where/include" AUXLIBS=/some/where/libdb.a
% make

Of course you will have to specify the actual location of the include directory and of the object library.

One problem: older DB versions install a file /usr/include/ndbm.h that is incompatible with the one in /usr/include. Be sure to get rid of the bogus file, or the linker will fail to find dbm_dirfno.


Up one level | Postfix FAQ