introduction
Based on the excellent http://www.electrictoolbox.com/changing-exim4-settings-debian-5-lenny/
Exim4, an e-mail application, is an MTA (Mail Transfer Agent) for sending and receiving emails on a system.
Exim4 is already installed in the Debian distribution. By default exim4 is set up to allow local delivery only. If you try to send email to a remote address you will get an error in the log files stating that "Mailing to remote domains not supported".
install
exim4 is already installed and running.
configure
What are all those "â" characters? It's about ASCII and unicode character sets.
- Open a CLI on the host ifw03.
- Use su to switch to the root account.
- Start the exim4 configuration dialog.
ifw03:~# dpkg-reconfigure exim4-config
Screen layout varies depending on your terminal size.ââââââââââââââââââââââââ⤠Mail Server configuration âââââââââââââââââââââââââ â â â Please select the mail server configuration type that best meets your â â needs. â â â â Systems with dynamic IP addresses, including dialup systems, should â â generally be configured to send outgoing mail to another machine, called â â a 'smarthost' for delivery because many receiving systems on the â â Internet block incoming mail from dynamic IP addresses as spam â â protection. â â â â A system with a dynamic IP address can receive its own mail, or local â â delivery can be disabled entirely (except mail for root and postmaster). â â â â <Ok> â â â âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
- Hit <enter> to select the <OK> option.
- Select the mail server configuration.
To allow outbound mail, select the "internet site" option.
ââââââââââââââââââââââ⤠Mail Server configuration âââââââââââââââââââââââ â General type of mail configuration: â â â â internet site; mail is sent and received directly using SMTP â â mail sent by smarthost; received via SMTP or fetchmail â â mail sent by smarthost; no local mail â â local delivery only; not on a network â â no configuration at this time â â â â â â <Ok> <Cancel> â â â âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
The remaining screens vary a little depending on which option was selected. Those shown below are when "internet site" was selected as the type. - Specify the hostname for the mail server: ifw03.planetlarg.com
ââââââââââââââââââââââââ⤠Mail Server configuration âââââââââââââââââââââââââ â The 'mail name' is the domain name used to 'qualify' mail addresses â â without a domain name. â â â â This name will also be used by other programs. It should be the single, â â fully qualified domain name (FQDN). â â â â Thus, if a mail address on the local host is foo@example.org, the â â correct value for this option would be example.org. â â â â This name won't appear on From: lines of outgoing messages if rewriting â â is enabled. â â â â System mail name: â â â â ifw03.planetlarg.com___________________________________________________ â â â â <Ok> <Cancel> â â â âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
- List the IP addresses that the mail server will listen on to accept mail from.
First accept the description.
ââââââââââââââââââââââââ⤠Mail Server configuration âââââââââââââââââââââââââ â â â Please enter a semicolon-separated list of IP addresses. The Exim SMTP â â listener daemon will listen on all IP addresses listed here. â â â â An empty value will cause Exim to listen for connections on all â â available network interfaces. â â â â If this system only receives mail directly from local services (and not â â from other hosts), it is suggested to prohibit external connections to â â the local Exim daemon. Such services include e-mail programs (MUAs) â â which talk to localhost only as well as fetchmail. External connections â â are impossible when 127.0.0.1 is entered here, as this will disable â â listening on public network interfaces. â â â â <Ok> â â â âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
- Second, put in the IP address.
Incoming emails from the local machine are sent to the internal IP address 127.0.0.1.
Remote connections use a different IP address.
ââââââââââââââââ⤠Mail Server configuration ââââââââââââââââ â IP-addresses to listen on for incoming SMTP connections: â â â â 127.0.0.1;192.168.80.1____________________________________ â â â â <Ok> <Cancel> â â â âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
List which domains the mail server will accept mail for.ââââââââââââââââââââââââ⤠Mail Server configuration âââââââââââââââââââââââââ â Please enter a semicolon-separated list of recipient domains for which â â this machine should consider itself the final destination. These domains â â are commonly called 'local domains'. The local hostname â â (sitehost.securehosting.co.nz) and 'localhost' are â â always added to the list given here. â â â â By default all local domains will be treated identically. If both â â a.example and b.example are local domains, acc@a.example and â â acc@b.example will be delivered to the same final destination. If â â different domain names should be treated differently, it is necessary to â â edit the config files afterwards. â â â â Other destinations for which mail is accepted: â â â â ifw03.planetlarg.com_____________________________________________ â â â â <Ok> <Cancel> â â â âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
Specify which domains the mail server will relay mail for.ââââââââââââââââââââââââ⤠Mail Server configuration âââââââââââââââââââââââââ â Please enter a semicolon-separated list of recipient domains for which â â this system will relay mail, for example as a fallback MX or mail â â gateway. This means that this system will accept mail for these domains â â from anywhere on the Internet and deliver them according to local â â delivery rules. â â â â Do not mention local domains here. Wildcards may be used. â â â â Domains to relay mail for: â â â â _________________________________________________________________________ â â â â <Ok> <Cancel> â â â âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
- Enter IP addresses allowed to send mail via here.
It's possible to always relay mail from a particular IP address(es) or range.
This next screen allows you to specify these.
For example you might have several web servers but want all of them to send their mail via a specific mail server.
You would then enter those servers IP addresses here, separated by semi-colons.
ââââââââââââââââââââââââ⤠Mail Server configuration âââââââââââââââââââââââââ â Please enter a semicolon-separated list of IP address ranges for which â â this system will unconditionally relay mail, functioning as a smarthost. â â â â You should use the standard address/prefix format (e.g. 194.222.242.0/24 â â or 5f03:1200:836f::/48). â â â â If this system should not be a smarthost for any other host, leave this â â list blank. â â â â Machines to relay mail for: â â â â 192.168.0.0/16______________________________________________________________ â â â â <Ok> <Cancel> â â â âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
- The next option is about DNS queries.
You'd normally leave this as the default <No>
âââââââââââââââââââââââ⤠Mail Server configuration âââââââââââââââââââââââââ â â â In normal mode of operation Exim does DNS lookups at startup, and when â â receiving or delivering messages. This is for logging purposes and â â allows keeping down the number of hard-coded values in the â â configuration. â â â â If this system does not have a DNS full service resolver available at â â all times (for example if its Internet access is a dial-up line using â â dial-on-demand), this might have unwanted consequences. For example, â â starting up Exim or running the queue (even with no messages waiting) â â might trigger a costly dial-up-event. â â â â This option should be selected if this system is using Dial-on-Demand. â â If it has always-on Internet access, this option should be disabled. â â â â Keep number of DNS-queries minimal (Dial-on-Demand)? â â â â <Yes> <No> â â â ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
- Choose how to store locallly delivery mail.
Select the option you prefer and then <OK>
ââââââââââââââââââââââââ⤠Mail Server configuration âââââââââââââââââââââââââ â Exim is able to store locally delivered email in different formats. The â â most commonly used ones are mbox and Maildir. mbox uses a single file â â for the complete mail folder stored in /var/mail/. With Maildir format â â every single message is stored in a separate file in ~/Maildir/. â â â â Please note that most mail tools in Debian expect the local delivery â â method to be mbox in their default. â â â â Delivery method for local mail: â â â â mbox format in /var/mail/ â â Maildir format in home directory â â â â â â <Ok> <Cancel> â â â âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
- Finally choose how the configuration is stored.
You would normally just leave it as the default <No> unless you have some reason to do it differently.
ââââââââââââââââââââââââ⤠Mail Server configuration âââââââââââââââââââââââââ â â â The Debian exim4 packages can either use 'unsplit configuration', a â â single monolithic file (/etc/exim4/exim4.conf.template) or 'split â â configuration', where the actual Exim configuration files are built from â â about 50 smaller files in /etc/exim4/conf.d/. â â â â Unsplit configuration is better suited for large modifications and is â â generally more stable, whereas split configuration offers a comfortable â â way to make smaller modifications but is more fragile and might break if â â modified carelessly. â â â â A more detailed discussion of split and unsplit configuration can be â â found in the Debian-specific README files in /usr/share/doc/exim4-base. â â â â Split configuration into small files? â â â â <Yes> <No> â â â âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
After accepting the last setting the settings application closes and the exim mail server is restarted.
Stopping MTA for restart: exim4_listener. Restarting MTA: exim4.
It will now be working with the new set of options.

