Configure Exim4 to Send Email Through a Password Protected Relay Host

After installing exim4, run

sudo dpkg-reconfigure exim4-config

and use these config options:

  • General type of mail configuration: mail sent by smarthost; received via SMTP or fetchmail
  • System mail name: <your hostname>
  • IP-address to listen on for incoming SMTP connections:
  • Other destinations for which mail is accepted: <your hostname>
  • Machines to relay mail for: <leave this blank>
  • IP address or host name of the outgoing smarthost:
  • Hide local mail name in outgoing mail?
    • Yes – all outgoing mail will appear to come from your gmail account
    • No – mail sent with a valid sender name header will keep the sender’s name
  • Keep number of DNS-queries minimal (Dial-on-Demand)? No
  • Delivery method for local mail: <choose the one you prefer>
  • Split configuration file into small files? Yes (you need to edit one of the files next)

Then run

sudo gedit /etc/exim4/passwd.client

and add the following lines for your mail host, and any aliases it has (found through nslookup). Substitute <email address> and <password> with the account you want to route mail through):<email address>:<password>

Once you edit the passwd.client file, run

sudo update-exim4.conf

which will integrate your changes into your Exim4 config.


sudo /etc/init.d/exim4 restart

and make sure that the service stops and starts properly.

So, type that to test,

echo "Testing." | mail -s Test

Leave a Reply