Exim 4

Exim is the default mail service with Debian.
It's enough for most needs but must be configured to forward emails to a relay.

For company use, the relay is generally local, at home the relay is provided by the ISP.
For those who owns a gmail or google apps account, it is possible to use gmail as a relay.

Installation

Exim4 is installed by default, it's the following package :

  • exim4

Setup

Exim setup is done with the command :

dpkg-reconfigure exim4-config

Installation types are :

  • internet site : exim send emails directly to the destination server. Attention this option doesn't work with a common home access (Cable/xDSL) because IPs are blacklisted.
  • mail sent by smarthost; received via SMTP or fetchmail : forward emails to a relay, accept local emails. To use if the server hold local mailboxes.
  • mail sent by smarthost; no local mail : forward emails to a relay, no local mailbox. Allow the server to send emails, this options is generally used.
  • local delivery only; not on a network : closed relay, only deliver to local mailboxes.

For a server that just needs to send email outside, we need to choice “mail sent by smarthost; no local mail”.

The settings to configure are :

  • System mail name (mailname) : the server name, for example debian.bouthors.fr
  • IP-addresses to listen on for incoming SMTP connections : IP list allowed to send emails, for example 127.0.0.1.
  • Other destinations for which mail is accepted : used to store mails on this server
  • Visible domain name for local users : name used for local accounts when they send emails outside, par exemple bouthors.fr
  • IP address or host name of the outgoing smarthost : IP of dns name of the relay, some examples :
    • simple relay : 192.168.10.1
    • SMTPS relay (port 587) : smtp.gmail.com::587
    • 2 relays (the second one is used only if the first one is not available) : 192.168.10.1:192.168.10.2
  • Keep number of DNS-queries minimal (Dial-on-Demand) : no
  • Split configuration into small files? : no

To enable SMTP authentication, we need to edit the file /etc/exim4/passwd.client and some lines with this template :

smtp.serveur.com:nom:pass

Then execute :

update-exim4.conf

To check if it's working, just send an email with the “mail” command :

# mail a.valid.email@gmail.com
Subject: test
this is a test
.
Cc:
#

Example of gmail configuration

Steps :

  • execute dpkg-reconfigure exim4-config
    • General type of mail configuration : mail sent by smarthost; no local mail
    • System mail name : bouthors.fr
    • IP-addresses to listen on for incoming SMTP connections : 127.0.0.1
    • Other destinations for which mail is accepted :
    • Visible domain name for local users : bouthors.fr
    • IP address or host name of the outgoing smarthost : smtp.gmail.com::587
    • Keep number of DNS-queries minimal (Dial-on-Demand) : no
    • Split configuration into small files? : no
  • edit /etc/exim4/passwd.client :
# password file used when the local exim is authenticating to a remote
# host as a client.
#
# see exim4_passwd_client(5) for more documentation
#
# Example:
### target.mail.server.example:login:password
gmail-smtp.l.google.com:compte@bouthors.fr:*********
*.google.com:compte@bouthors.fr:*********
smtp.gmail.com:compte@bouthors.fr:*********
  • execute update-exim4.conf
  • restart exim : /etc/init.d/exim4 restart

Result config inside /etc/exim4/update-exim4.conf.conf :

# /etc/exim4/update-exim4.conf.conf
#
# Edit this file and /etc/mailname by hand and execute update-exim4.conf
# yourself or use 'dpkg-reconfigure exim4-config'
#
# Please note that this is _not_ a dpkg-conffile and that automatic changes
# to this file might happen. The code handling this will honor your local
# changes, so this is usually fine, but will break local schemes that mess
# around with multiple versions of the file.
#
# update-exim4.conf uses this file to determine variable values to generate
# exim configuration macros for the configuration file.
#
# Most settings found in here do have corresponding questions in the
# Debconf configuration, but not all of them.
#
# This is a Debian specific file

dc_eximconfig_configtype='satellite'
dc_other_hostnames=''
dc_local_interfaces='127.0.0.1'
dc_readhost='bouthors.fr'
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost='smtp.gmail.com::587'
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname='true'
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'

Backup

  • /etc/exim4/update-exim4.conf.conf
  • /etc/exim4/passwd.client

Links

en/linux/exim.txt · Last modified: 2013/07/10 18:31 by matthieu
Recent changes RSS feed Debian Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki