How To Configure EXIM4 As A Smart Host For Fastmail – For Sending SMTP Only

I am using the latest Ubuntu LTS (18.04).

First We need to obtain some information. Go to your favorite search engine and search for “fastmail ports”, you are looking for this page Fastmail Ports, look for the SMTP ports section and find out what URL and ports are currently being used for SMTP.

You will also need an app password as Fastmail does not use your account password for email related functions.

So, 4 things you need from Fastmail are, URL and port of SMTP server and your account username and SMTP app password.  Since this is a SMTP only setup, when creating the app password, select SMTP for app password only, in order to minimize security concerns.

Now we need to install Exim4. Do this by running APT.
sudo apt update
sudo apt install exim4

Then we need to configure EXIM4 using the command below.
sudo dpkg-reconfigure exim4-config

I’ll walk you through this with screenshots.  Just use the selection in the screenshots.

  1.  In this image we select smarthost.  The smarthost is Fastmail.  We won’t worry about getting mail.EXIM4-1
  2. Here we change the mail name to localhost.  Don’t worry, your mail will still say from your address of your choosing.  Example, if you send email as, people will see your email as
  3. Unless your an Internet Service Provider or your name is Google, Yahoo, Microsoft, etc. You should not open your EXIM4 to the outside world.  Virtually all ISP’s in the world filter port 25 and block it and letting EXIM4 listen to the outside world wouldn’t do you any good anyways except to open you to crackers.  I used to run my own mail server, and I got to tell you it’s a lot of work staying one step ahead of the crackers and it’s expensive too for an high speed unfiltered line where the ISP lets you do what you want.  Just don’t do it.  Accept the defaults here.  Don’t change them unless you truly know what your doing.EXIM4-3
  4. The configuration script is pretty good at picking the right default here.  Unless you know what your doing, I’d recommend just accepting the default.EXIM4-4
  5. Most likely you don’t want to be a relay for spam, so just leave this blank.  The exception would be a small Home/SMB network where the EXIM4 server is relaying for clients on the same subnet of the local network.EXIM4-5
  6. Fill this out just like the screenshot.  The port used is 587.  I couldn’t figure out how to make port 465 work.  If anybody knows how to make port 465 work, let me know.EXIM4-6
  7. Accept defaults here.  No reason to change things unless you know what you are doing.  If you think this will hide your identity, your mistaken.EXIM4-7
  8. Unless your Internet connection is powered by a dial up 56K modem or worse, leave this on no.EXIM4-8
  9. Frankly, it comes down to what side of the bed you woke up on this morning.  Just accept defaults.  The EXIM4 maintainers have chosen the default for a reason and that’s good enough for me.EXIM4-9
  10. For home (consumers) users looking for maximum stability with the least amount of breakage on updating and upgrades, I would go with “no”.  For large and complicated Home/SMB networks where the user has extensive command line knowledge and experience, I would go with “yes”.  However, if you go with yes, you may run into problems when updating and upgrading Debian and Debian based Distros.EXIM4-10
  11. Sorry!!!  I failed to get the last screenshot!!!  Once you go through the process the last screen doesn’t appear again.  On the very last screen where it ask you, “where do you want to deliver root mail to”, put in your username.  For example, if your username is joe, that you use when logging into Debian, Ubuntu etc, that is what you put on the line.

At this point the script will end and dump you back to the terminal.  But we’re not done yet!  Not by a long shot.

Now we have to edit the passwd.client file in /etc/exim4.

Change directory to the EXIM4 directory in /etc.

cd /etc/exim4

Lets take a look at what’s in the directory.


We should see a file called “passwd.client”.  Now lets edit that file.

sudo nano passwd.client

Screenshot of the nano text editor and what the file should look like properly done up for Fastmail.  Notice that the password is the app password you generated at the Fastmail website.  The password is NOT your Fastmail account password.  Also notice that you do not use as the server, you use, “*”.  That’s a star followed by a period then


Press Ctrl+x, press y, press enter.  Your dumped to command line.

You have now completed the tutorial.  All that’s left is a test.  Fire up mutt.



Send those emails.  Hit me up in the comments if you have problems.