HowTo: Using Exim4 to send messages through Gmail
Wow a long time passed since I last wrote an article here. I was planning a “HowTo: Start fresh with Windows and don’t lose anything.” but then I stopped using Windows and moved to GNU/Linux instead. Well things have changed and now you have this article instead which actually is an adaptation of the debian wiki page.
Step 1: Reconfigure exim4
-
sudo dpkg-reconfigure exim4-config
- There we have a set of questions, the important answers are:
- Choose: mail sent by SMARTHOST; received via SMTP or fetchmail
- In system mail name type: localhost
- In IP Adresses to listen on for incoming SMTP connections type127.0.0.1
- Leave Other destinations for which mail is accepted blank
- Leave Machines to relay mail for blank too
- In Machine handling outgoing mail for this host (smarthost) type: smtp.gmail.com::587
- Choose NO in response to “don’t hide local mail name in outgoing mail”
- Choose NO in response to “don’t keep number of DNS-queries minimal (Dial-on-Demand)”
- Choose YES in response to “split configuration into small files”
NOTE THAT THE ‘::’ ARE NOT A TYPO
Step 2: Final touchs
- Now we need to tell exim4 about your gmail credentials:
sudo vi /etc/exim4/passwd.client
There we are going to put the following text, replacing where needed:
gmail-smtp.l.google.com:yourAccountName@gmail.com:y0uRpaSsw0RD *.google.com:yourAccountName@gmail.com:y0uRpaSsw0RD smtp.gmail.com:yourAccountName@gmail.com:y0uRpaSsw0RD
- And finally we need to tell exim4 how it should bind the system account with the gmail account:
sudo sh -c "echo 'YOUR-USER-NAME@LocalHost: yourAccountName@gmail.com' >> /etc/exim4/email-addresses"
Step 3: Update exim4 and enjoy!
- Make exim4 know about the changes:
sudo update-exim4.conf
- Test your new configuration and enjoy if it works!



you’re a genius! works like a charm, thanks - great howto.