Changing exim4 settings with Debian 5 Lenny
Posted March 23rd, 2009 in Linux/Unix/BSD
Exim4 is a mail transfer agent for sending and receiving emails on a server. This post looks at how to change the major configuration options on Debian 5 Lenny, which incudes how to allow remote delivery of emails to avoid the "Mailing to remote domains not supported" error.
These instructions are for Debian but should also work for Debian derived Linux distributions with exim4 installed such as the Ubuntu family, Knoppix, Mepis etc.
To start the exim4 configuration dialog on Debian 5 Lenny run the following command either as the root user or using the sudo utility command:
$ dpkg-reconfigure exim4-config
This will start the configuration dialogs. Depending on your terminal size, the first screen will appear over two pages (as I've shown below) or as a single screen.
âââââââââââââââââââââââââ¤ 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> â â â âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
After hitting <enter> to select the <OK> option you will then be taken through to the dialog where you select which type of mail server configuration. By default exim4 will be set up to allow local delivery only and 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".
To allow outbound mail, select the "internet site" option. I also tried the second option but it still wouldn't send mail. Selecting the internet site option allowed the mail to be sent. There must be some other configuration option with the smarthost options but I couldn't work it out.
âââââââââââââââââââââââ¤ 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.
The next dialog allows you to specify the hostname for the mail server.
âââââââââââââââââââââââââ¤ 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 firstname.lastname@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: â â â â sitehost.securehosting.co.nz_____________________________________________ â â â â <Ok> <Cancel> â â â âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
The next screen allows you to select the IP addresses that the mail server will listen on to accept mail from. If your terminal is large enough it will show the next two screens below on one screen.
âââââââââââââââââââââââââ¤ 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> â â â âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
If you only want the server to listen to incoming emails from the local machine then leave it as 127.0.0.1; if you want to allow remote connections then specify 127.0.0.1, then a semi-colon and then the IP address of the server itself.
âââââââââââââââââ¤ Mail Server configuration âââââââââââââââââ â IP-addresses to listen on for incoming SMTP connections: â â â â 127.0.0.1________________________________________________ â â â â <Ok> <Cancel> â â â âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
This screen allows you to specify 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, email@example.com and â â firstname.lastname@example.org 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: â â â â sitehost.securehosting.co.nz_____________________________________________ â â â â <Ok> <Cancel> â â â âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
This screen allows you to 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> â â â âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
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. 18.104.22.168/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: â â â â _________________________________________________________________________ â â â â <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> â â â ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
The next option is 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.
- Enable and disable init scripts on Debian (Wednesday, October 24th 2012)
- Set the timezone on Debian 5 Lenny (Thursday, December 30th 2010)
- Changing the default message of the day with Debian 5 Lenny (Thursday, March 19th 2009)