Mail Transfer Agents

Although this documentation does not seek to cover the details of configuring mail transfer agent (MTA) software, some hints and tips are offered to help avoid frustration.

General

Some general measures are presented below.

Hostname

The hostname command should provide a suitable hostname on the system, or MTAs may behave strangely. This can be tested with the following command:

hostname -f

It should report a fully-qualified hostname.

Mailname

The contents of /etc/mailname should probably be the fully-qualified hostname, at least for Exim and Postfix. See the Debian Wiki page for more details.

Interfaces

Some software attempts to listen on interfaces that may not be supported. For example, Exim may be configured to listen on both IPv4 and IPv6 interfaces, even in environments (such as User Mode Linux) where IPv6 interfaces may not be available.

Authentication

It is highly undesirable to allow anyone to connect to a mail server to send mail. However, it is highly convenient to allow imip-agent to connect to the mail server on the same host without having to provide credentials. Consequently, the configuration of an MTA must permit the latter without allowing the former.

Fortunately, many MTAs are configured to allow local connections because programs typically rely on such traditional behaviour, but this may be worth checking if mail server logs indicate authentication failures when imip-agent is attempting to send mail.

Exim

On Debian, the following command can be run to adjust the configuration:

dpkg-reconfigure exim4-config

The following questions are especially interesting:

Question Remarks
IP-addresses to listen on for incoming SMTP connections Remove IPv6 interfaces in User Mode Linux or other environments without IPv6 support or Exim will not bother listening on IPv4 interfaces either.
System mail name State the fully-qualified hostname, not just the domain name, which is what the dialogue suggests is sufficient. For example:
mailserver.example.com
Other destinations for which mail is accepted This is a colon-separated list that should indicate the local domain as well as the unqualified hostname. For example:
mailserver:example.com

Useful Commands

The following commands prove useful when troubleshooting and appear to be available as shown within a Debian environment.

Task Exim Postfix
Check the mail queue mailq
Process the mail queue sendmail -q (or exim -q or runq) sendmail -q (or postqueue)
Flush the mail queue exim -qff postqueue -f
Deliver a specific message exim -M <identifier> postqueue -i <identifier>
Test delivery for an address sendmail -bt <address> (see also sendmail -v -bv <address> and sendmail -v -bvs <address>)

See Exim Cheatsheet and Postfix Debugging Howto for more guidance.