Exim configuration:

You may remember that during your Debian installation process, you were prompted to answer a few questions to configure your e-mail system. These questions and your answers were processed by the Exim Debian package's installation script, which is configured to run when the Exim package has been installed.

You can choose to re-run this script at any time, by simply running "/usr/sbin/eximconfig" as root. You can do this now:

debian:~# eximconfig 
You already have an exim configuration. \
                Continuing with eximconfig
will overwrite it. It will not keep any local \
                modifications you have made.
If that is not your intention, you should break \
                out now. If you do continue,
then your existing file will be renamed with \
                .O on the end.
[---Press return---]

The configuration files which the script mentions are found in the "/etc/exim" directory. The main configuration file is "/etc/exim/exim.conf".

The script will present you with a set of choices:

<!--  =================== -->
You must choose one of the options below:

 (1) Internet site; mail is sent and received directly \
                using SMTP. If your
     needs don't fit neatly into any category, you \
                probably want to start
     with this one and then edit the config file by hand.

 (2) Internet site using smarthost: You receive Internet \
                mail on this 
     machine, either directly by SMTP or by running \
                a utility such as 
     fetchmail. Outgoing mail is sent using a smarthost. \
                Optionally with
     addresses rewritten. This is probably what you want \
                for a dialup

 (3) Satellite system: All mail is sent to another machine, \
                called a "smart 
     host" for delivery. root and postmaster mail is \
                delivered according 
     to /etc/aliases. No mail is received locally.

 (4) Local delivery only: You are not on a network. \
                Mail for local users is delivered.

 (5) No configuration: No configuration will be done now; \
                your mail system 
     will be broken and should not be used. You must \
                then do the 
     configuration yourself later or run this script, \
     as root. Look in /usr/share/doc/exim/example.conf.gz

Select a number from 1 to 5, from the list above.
Enter value (default='1', 'x' to restart): 

If you are setting up the machine to act as a server, but not specifically for e-mail, and you already have a dedicated e-mail server on your network, then you should select the second option.

If you are setting up the machine to act as a desktop, you should select the third option.

If you are setting up the machine to act as a mail server, then you should select the first option:

Select a number from 1 to 5, from the list above.
Enter value (default='1', 'x' to restart): 1
<!-- ====================== -->
What is the 'visible' mail name of your system? \
                This will appear on 
From: lines of outgoing messages.
Enter value (default='debian', 'x' to restart):    

Here you are prompted for the mail domain of your system. If your server was called "server.example.com", then you would probably want to configure your mail name as "example.com"; ie, e-mail addresses will have the form "user@example.com".

Enter value (default='debian', 'x' to restart): example.com
<!-- =========================== -->
Does this system have any other names which may \
                appear on incoming
mail messages, apart from the visible name above \
                (example.com) and

By default all domains will be treated the same; \
                if you want different 
domain names to be treated differently, you will \
                need to edit the config 
file afterwards: see the documentation for the \
                "domains" director option.

If there are any more, enter them here, separated \
                with spaces or commas.  
If there are none, say 'none'.
Enter value (default='none', 'x' to restart):

This question relates to "virtual domains" which you might host on your system. As stated above, the simple configuration system can only handle treating all virtual domains in the same manner, and this is fine for most simple setups.

For example, we may wish to receive e-mail destined for "user@example.org" (_.org_) as well as that destined for "user@example.com":

Enter value (default='none', 'x' to restart): example.org
<!-- ============================== -->


Again, as stated above, e-mail destined for either domain will be treated equally.

All mail from here or specified other local machines \
                to anywhere on
the internet will be accepted, as will mail from \
                anywhere on the 
internet to here. 

Are there any domains you want to relay mail for\
                ---that is, you are 
prepared to accept mail for them from anywhere \
                on the internet, but
they are not local domains.

If there are any, enter them here, separated with \
                spaces or commas. You
can use wildcards. If there are none, say 'none'. \
                If you want to relay 
mail for all domains that specify you as an MX, \
                then say 'mx'
Enter value (default='none', 'x' to restart): 

This question relates to any domains for which we are the backup mailserver. Although you can tell Exim to use MX records to determine this, rather than using a hardcoded list, this is not recommended.

Enter value (default='none', 'x' to restart): 
==================== -->
Obviously, any machines that use us as a smarthost \
                have to be excluded
from the relaying controls, as using us to relay mail \
                for them is the
whole point.

Are there any networks of local machines you want \
                to relay mail for?

If there are any, enter them here, separated with \
                spaces or commas.  You
should use the standard address/length format \
If there are none, say 'none'.

You need to double the colons in IPv6 addreses \
                (e.g.  5f03::1200::836f::::/48)
Enter value (default='none', 'x' to restart): 

Here you must specify a list of machines and/or networks for which we will relay mail for. Be very careful with your answer here, otherwise you could be allowing untrusted people to use your mail server!

You should normally only specify your own network block:

Enter value (default='none', 'x' to restart):

This means that any machines on the network will be able to use your machine as an SMTP relay.

Enter value (default='none', 'x' to restart):
Names are localhost:example.com:example.com!
<!--======================== -->
Mail for the 'postmaster' and 'root' accounts is \
                usually redirected
to one or more user accounts, of the actual \
                system administrators.
By default, I'll set things up so that mail for \
                'postmaster' and for
various system accounts is redirected to \
                'root', and mail for 'root'
is redirected to a real user.  This can be \
                changed by editing /etc/aliases.

Note that postmaster-mail should usually be \
                read on the system it is
directed to, rather than being forwarded elsewhere,\
                so (at least one of)
the users you choose should not redirect their \
                mail off this machine.

Which user account(s) should system \
                administrator mail go to ?
Enter one or more usernames separated \
                by spaces or commas .  Enter
'none' if you want to leave this mail in \
                'root's mailbox - NB this
is strongly discouraged.  Also, note that \
                usernames should be lowercase!

As directed above, you should direct e-mail for the 'postmaster' and 'root' accounts to a normal user account, preferably your own.

Enter value ('x' to restart): student

These particular settings can be modified later in the /etc/aliases file.

Once that's done, you'll be presented with a configuration summary:

The following configuration has been entered:
======================== -->
Mail generated on this system will have 'example.com' used
as the domain part (after the @) in the From: field \
                and similar places.

The following domain(s) will be recognised as \
                referring to this system:
 localhost, example.com, example.com

Mail for postmaster, root, etc. will be sent to student.

Local mail is delivered.

Outbound remote mail is looked up in the Internet \
                DNS, and delivered
using that data if any is found; otherwise such \
                messages are bounced.

Note that you can set email addresses used for \
                outgoing mail by editing

Is this OK ?  Hit Return or type 'y' to confirm it \
                and install,
or 'n' to make changes (in which case we'll go \
                round again, giving you
your previous answers as defaults.     (Y/n) 

If you're happy with the configuration, you can simply hit Enter:

your previous answers as defaults.     (Y/n) Y

Keeping previous /etc/exim/exim.conf as /etc/exim/exim.conf.O

Keeping previous /etc/aliases as /etc/aliases.O

Keeping previous /etc/mailname as /etc/mailname.O

Configuration installed.


Once you've reached this point, you should inspect the /etc/exim/exim.conf file to familiarise yourself with its contents.

Some of the more important options are:

qualify_domain = example.com

This specifies the domain which will be appended to any addresses which do not already have one.

local_domains = localhost:example.com:example.org

This list of domains specifies which @domains are considered to be local. Exim will then attempt to deliver any e-mail to these addresses in the relevant file in /var/spool/mail/${user}, where user is taken from the address "user@domain".

relay_domains =

This is a list of domains for which we accept e-mail, although we don't consider them to be local domains. These are domains for which we are a backup or secondary mail server.

host_accept_relay = : ::::1 :

This is the list of networks for which we will act as an SMTP server, and thus relay mail for.

The /etc/aliases file contains a simple list in the following format:

postmaster: root
root: student

In the above example, Exim will redirect e-mail destined for "postmaster" to "root", and will in turn redirect e-mail for "root" to "student".

You can also specify multiple target addresses, separated with a comma:

root: student1, student2