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

  1. sudo dpkg-reconfigure exim4-config
  2. There we have a set of questions, the important answers are:
    1. Choose: mail sent by SMARTHOST; received via SMTP or fetchmail
    2. In system mail name type: localhost
    3. In IP Adresses to listen on for incoming SMTP connections type127.0.0.1
    4. Leave Other destinations for which mail is accepted blank
    5. Leave Machines to relay mail for blank too
    6. In Machine handling outgoing mail for this host (smarthost) type: smtp.gmail.com::587
    7. NOTE THAT THE ‘::’ ARE NOT A TYPO

    8. Choose NO in response to “don’t hide local mail name in outgoing mail”
    9. Choose NO in response to “don’t keep number of DNS-queries minimal (Dial-on-Demand)”
    10. Choose YES in response to “split configuration into small files”

Step 2: Final touchs

  1. 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
  2. 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!

  1. Make exim4 know about the changes:
    sudo update-exim4.conf
  2. Test your new configuration and enjoy if it works!

Information and Links

Join the fray by commenting, tracking what others have to say, or linking to it from your blog.


Other Posts
OneLiner: Extract audio from YouTube.com video. (FLV)
Like this site? Now you can contribute!

Write a Comment

Take a moment to comment and tell us what you think. Some basic HTML is allowed for formatting.

Reader Comments

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

Thank you very much :)
That was exactly what I needed ;)

Great! Big thanks from switzerland!

Hi! I was surfing and found your blog post… nice! I love your blog. :) Cheers! Sandra. R.

Sign: zdbrw Hello!!! xtvan and 3347ffufpvgbmq and 3567 : Cooooool blog really