Go to TogaWare.com Home Page.
GNU/Linux Desktop Survival Guide
by Graham Williams
Google

Exim


The default email server for Debian is exim. This can be set up in one of several ways, depending on how you will access your email. The exim configurator will list the options. The newer exim4 will become the default at some time and its configuration is somewhat simpler. To configure it:



  $ wajig reconfigure exim4-config

For a machine connected to the Internet, receiving email via fetchmail, for example, and using a remote SMTP server to send email, the setup might be:



  Personal preference as to whether you split config into smaller files
  mail sent by smarthost; received via SMTP or fetchmail
  System mail name: athens.togaware.com
  Four <Return> # Just choose the defaults. 
  Smarthost: mailhost.togaware.com
  Hide local mail name in outgoing mail? Yes
  Visible domain name for local users: togaware.com
  One <Return> # Choose the default

The file /etc/exim4/update-exim4.conf.conf contains the simple configuration information which is used to generate the more complex exim4 configuration files. Assuming you choose not to split the configuration file, the configuration file for manual editing is /etc/exim4/exim4.conf.template.

If you use Maildir formats that you want your local email to deliver to you can change:

  LOCAL_DELIVERY=mail_spool

to:

  LOCAL_DELIVERY=maildir_home

The file /etc/email-addresses can be used to generate a From: address for each user (so that the From address will not be the default of the user@host).

You can have exim4 rewrite email addresses by adding something like the following two lines after the begin rewrite:

  begin rewrite
  kayon@togaware.com Kayon.Toga@togaware.com s
  kayon Kayon.Toga@togaware.com F

Use exim -Mvh $<$messageid$>$ to list the headers of email waiting to be sent. Use exim -Mvb $<$messageid$>$ to view the body of an email waiting to be sent. Use exim -Mrm $<$messageid$>$ to remove a message from the queue waiting to be sent.

If you have a bunch of frozen messages you want to remove, the following command will do it:

  # exiqgrep -zi | xargs exim -Mrm

Exim will not bounce emails if the original message looks like a bounce. Instead the message is frozen, awaiting the SysAdmin's attention. To bounce the message with a message to the original user, and thereby removing it from the queue, use -Mg $<$messageid$>$.

Some other tricks for managing the exim mail queue with exiqgrep include:



  # exiqgrep -zi -o 86400       # Frozen messages older than a day
  # exiqgrep -z -f ""           # Double bounces

You can check other information with exinext, for example to see when exim will try sending to gte.net again (assuming there is an email in the queue for a user at gte.net:

  # exinext gte.net
  Transport: relay.gte.net [206.46.170.12]:1BnRRO-000Bg5-OH error 0:
  SMTP error from remote mailer after end of data: host relay.gte.net
  [206.46.170.12]: 421 sc008pub.verizon.net lost
  connection(mta019.verizon.net)
    first failed: 25-Jul-2004 03:14:45
    last tried:   25-Jul-2004 06:43:24
    next try at:  25-Jul-2004 08:13:24

(These examples thanks to Lanny Godsey.)

Exim places its email in /var/spool/exim4/, each message has a common prefix with three files corresponding to the mail body, mail header, and exim data.

Copyright © 1995-2006 Graham.Williams@togaware.com
Contribue and access the PDF Version