Thursday, January 18, 2007

How to - Setup exim4 on Ubuntu Linux machine.

So I don't have to go looking for this information each time I try to setup my email client exim (exim4 currently) I will place the how to do it here. I want to setup a simple mail setup with all mail being relayed via my SMTP ISP host and only retrieving mail via pop or imap clients.

Here is what you do:
# install exim4 first if not already installed.
$ sudo aptitude install exim4

#  this will start the configuration tool and questions that lead to a valid
# config file.
$ sudo dpkg-reconfigure exim4-config

# answer no to split files, I like a single config file.

# choose mail-sent-by-smart-host and no-local-delivery as my ISP
# will be my SMTP relay and I don't need to pull mail down to my
# machines.

# enter your hostname, provided by your ISP most of the time.

# set listening on hosts to as I am only sending outgoing
# mail and retrieving via pop or imap clients.

# I have no domains I wish to receive mail for, so leave the next option
# on the default of local host.

# visible domain name for local users I set to my ISP given domain name.

# outgoing mail host for sending is your ISP given SMTP server.

# for DNS queries I answered 'no', as this is the last question it ends
# and restarts the MTA (exim), time to test it by sending an email!

Pretty easy no? ;-)


  1. thank you. you saved me a lot of time. I appreciate your effort to write this up. -- scott

  2. This is great info. There is one other point missing that may be helpful to some. This is from the Ubuntu page near the bottom:

    "Note that sending mail directly to the Internet when you don't have an official domain name, can result in your mail being rejected because of anti-spam measures on receiving servers. Using your ISP's mail server is preferred. If you still do want to send out mail directly, you may want to use a different e-mail address than is generated by default. If you use exim4 as your MTA, this is possible by adding an entry in /etc/email-addresses."

    I modified my /etc/email-addresses and now it works fine.

  3. Good tip about the email-addresses file. Thanks for taking the time to improve this information. ;-)