Exim configuration

How to find out if you are using exim (Debian)

Exim is a package that supplies the sendmail program. Type

    type sendmail
to find out the path of sendmail. On my machine it is
    /usr/sbin/sendmail
Then type
    dpkg -S /usr/sbin/sendmail
to find out what package provides it. On my machine it is exim4-daemon-light. If it is anything with the word "exim" in it, you are using exim.

How to change the Exim configuration

To reconfigure exim on Debian, type

    sudo dpkg-reconfigure exim4-config
which will ask a bunch of questions and then set up your system. This changes config files and restarts the exim daemon - nothing else to do.

Useful Exim Configuration Example

Here are the questions that dpkg-reconfigure asked me, and the answers that worked for me:
    System mail name: $DOMAIN
    IP-addresses to listen on for incoming SMTP connections:  127.0.0.1
    Other destinations for which mail is accepted: $HOSTNAME;$HOSTNAME.$DOMAIN
    Machines to relay mail for:                <<<this is left blank>>>
    IP address or host name of the outgoing smarthost: $SMARTHOST
    Hide local mail name in outgoing mail? <<YES>>
    Visible domain name for local users: $DOMAIN
    Keep number of DNS-queries minimal (Dial-on-Demand)? <<NO>>
    Delivery method for local mail:  mbox format in /var/mail/
    Split configuration into small files? <<NO>>
    Root and postmaster mail recipient: $USERNAME
You will have to change the above answers as follows:
	HOSTNAME = your hostname (not qualified).  Example:  "apooley-5" or "fatdragon"
	DOMAIN = domain where you get mail.  Example: "nvidia.com" or "rawbw.com"
	SMARTHOST = name of your outgoing SMTP mail server.  Example: "owa.nvidia.com" or "mail.rawbw.com"
	USERNAME = your username on the local machine (should be the same as your email address name)

Sendmail configuration

How to change the sendmail configuration

To configure sendmail edit

/etc/mail/sendmail.mc
(Note: back up the original file first). When done, save the file and run make in the same directory:
cd /etc/mail
sudo make
Then restart sendmail:
sudo /etc/init.d/sendmail restart

Useful Sendmail Configuration Example

To send all mail through a particular server (e.g. an Exchange server), specify the server like this:

define(`SMART_HOST',`mailgw.nvidia.com')

Set the domain that the mail should appear to come from like this:

MASQUERADE_AS(`nvidia.com')dnl
FEATURE(masquerade_envelope)dnl
MASQUERADE_DOMAIN(localhost)dnl
MASQUERADE_DOMAIN(localhost.localdomain)dnl

I think you can comment out these for safety:

dnl  # FEATURE(`accept_unresolvable_domains')dnl
dnl  # LOCAL_DOMAIN(`localhost.localdomain')dnl