Gmail smarthost with Exim4 on Debian

Setting up your Linux workstation or a virtual machine, there is no public IP or domain available. If you want to send mail from this machine, reverse DNS will fail and you will get the following error message:

Helo command rejected: need fully-qualified hostname

To avoid this situation, exim4 (the default Debian MTA) can be adjusted to use SMARTHOST (in this case a gmail account, but any other smtp server can be used).


Configure exim4 as following:

dpkg-reconfigure exim4-config


Create the file passwd.client

nano /etc/exim4/passwd.client

with the following contents


NOTE: if the password contains special characters ($, \, {}) you have to escape them. A simple solution is to use a strong password, but without dollar, closing brace, backslash, e.g. something like Nca-PZRn2_kfqW

Test it

Send a test mail to your email account

mail -s 'test my setup'

Press CTRL+D to exit

Check log file

tail /var/log/exim4/mainlog

2014-07-26 21:02:21 1S0dvp-0001Ce-2Z <= root@atlas U=root P=local S=317
2014-07-26 21:02:27 1S0dvp-0001Ce-2Z => R=smarthost T=remote_smtp_smarthost [] X=TLS1.0:RSA_ARCFOUR_SHA1:16 DN="C=US,ST=California,L=Mountain View,O=Google Inc,"
2014-07-26 21:02:27 1S0dvp-0001Ce-2Z Completed

Your comments are welcome!

Never Miss A Post!

Subscribe to our free NewsLetter