Configuring Exim4 as a Dreamhost SMTP relay

From Fyzix
Jump to navigation Jump to search

Use case - Say you want to relay email from your Linux server through your Dreamhost mail server.

For Debian and Ubuntu systems using the apt-get packager manager.

Please note, this is not an officially sanctioned practice at Dreamhost.


apt-get install -y exim4-base exim4-config exim4-daemon-light libmailutils4 mailutils mutt


Run the following:

dpkg-reconfigure exim4-config

1. Choose mail sent by smarthost; no local mail

2. Type System Mail Name: e.g.

3. Type IP Adresses to listen on for incoming SMTP connections: ; ::1

4. Leave Other destinations for which mail is accepted blank

5. Visible domain name for local users: or

6. IP address or host name of the outgoing smarthose:

7. Keep number of DNS-queries minimal (Dial-on-Demand)? No

8. Split configuration into small files? Yes


Modify /etc/exim4/conf.d/auth/30_exim4-config_examples and uncomment the following:

   driver = plaintext
   public_name = PLAIN
   server_condition = "${if crypteq{$auth3}{${extract{1}{:}{${lookup{$auth2}lsearch{CONFDIR/passwd}{$value}{*:*}}}}}{1}{0}}"
   server_set_id = $auth2
   server_prompts = :
   server_advertise_condition = ${if eq{$tls_cipher}{}{}{*}}

Don't worry about the plaintext. We will address that next to insure encrypted authentication.


Modify /etc/exim4/conf.d/main/01_exim4-config_listmacrosdefs

At the end of the file input


Modify /etc/exim4/passwd.client and input

Update/Restart exim4

service exim4 restart


Open two terminals.

On the first terminal tail the exim4 mail log in real time.

tail -f /var/log/exim4/mainlog

Send a test email through the relay

echo "test" | mail -s "subject"

If successful, you should see something to the effect of:

2015-04-12 21:33:47 1YhTFz-0001wW-1u <= U=root P=local S=480
2015-04-12 21:33:48 1YhTFz-0001wW-1u => R=smarthost T=remote_smtp_smarthost [] X=TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128 DN="C=US,postalCode=92821,ST=California,L=Brea,STREET=417 Associated Rd,O=Dreamhost Web Hosting,OU=admins,OU=Provided by New Dream Network\, LLC,OU=DreamHost Premium Wildcard SSL,CN=*"
2015-04-12 21:33:48 1YhTFz-0001wW-1u Completed

Plus the email should arrive at the receiving email address.