Apps & OS's Technology

How to install Exim4 on Ubuntu as a smarthost

For months now I have been trying to setup a fast, reliable linux mail server. I think I have now cracked it. Basically my system layout is as follows;

I have been developing a new social community site called UrbanParty (, The application is ran on my Ubuntu Linux server and uses SMTP to send out email notifications etc. In the past I have used Microsoft Windows server for mail as they are always much simpler to install and configure (well I think so anyway). However I could not really justify having another server for simply sending emails, Therefore I decided that im gunna try and crack the issue and thought that I would share the resolution with all of you 🙂

Ok here goes…

Firstly you will need Ubuntu linux installed, Im using Ubuntu Dapper Drake 6.06 (Server edition) however this how-to should also work for other versions of Ubuntu and should also work for Debian too.

Firstly we install Exim4 using ‘Apt-get’ so logon to your Ubuntu/Debian system as the ‘root’ user. Then issue this command:-

apt-get install exim4  exim4-config

Then Ubuntu should install the packages and then once installed issue this command:-

dpkg-reconfigure exim4-config

Now a graphical user interface will load to help you configure Exim quick, I am using my ISP’s SMTP server to ensure that all user’s recieve the email as mail services like Hotmail etc. are likely to block emails from unknown hosts. So now at the graphical prompts I do as follows:-

1. Choose: Mail sent by smarthost; Recieved by SMTP or Fetchmail
2. Enter Smathost relay:

You will need to obviously need to change the host name of the smarthost to match your ISP’s mail server.

Now to test the mail server, I installed ‘mailutils’ so issue this command at the prompt to install mailutils

apt-get install mailutils

That will install some simple mail utilitys that will allow us to test sending an email etc. Once installed do as follows:-

mail (enter your email address here)
(press enter for Cc:, type in subject, press enter)
 (type in body of message, then enter)
(type in single period, then enter, to end composing and email is queued)

Now you can check to see if the email message is still in the queue by typing the following command:


Your mail server should now be fully functional (for sending external messages) please not to recieve messages you may need further configuration of the mail server.

Hope this works for you.

If you liked this tutorial please show your support by visiting and registering on my site it would be nice of you to upload and set a profile photo of you too. Thanks all, Hope to see you on the site soon 🙂