Configuring Exim to use Gmail as a Smarthost

Add a router before or instead of the dnslookup router:

gmail_route:
  driver = manualroute
  transport = gmail_relay
  route_list = * smtp.gmail.com

Add a transport:

gmail_relay:
  driver = smtp
  port = 587
  hosts_require_auth = $host_address
  hosts_require_tls = $host_address

Add an authenticator (replacing myaccount@gmail.com and mypassword with your own account details):

gmail_login:
  driver = plaintext
  public_name = LOGIN
  hide client_send = : myaccount@gmail.com : mypassword

$host_address is used for hosts_require_auth and hosts_require_tls instead of smtp.gmail.com to avoid occasional 530 5.5.1 Authentication Required errors. These are caused by the changing IP addresses in DNS queries for smtp.gmail.com. $host_address will expand to the particular IP address that was resolved by the gmail_route router.

This entry was posted in Sysadmin and tagged , , . Bookmark the permalink.

4 Responses to Configuring Exim to use Gmail as a Smarthost

  1. NorB says:

    In Ubuntu 8.04.1 exim4 requires the driver to be specified so an additional line is needed in the router part :

    gmail_route:
    driver = manualroute
    transport = gmail_relay
    route_list = * smtp.gmail.com

    Otherwise, it works flawlessly.

    Thank you very much for this post !

  2. Phil says:

    Hi NorB,

    Thanks for spotting that. I’ve corrected the post.

    Phil

  3. Pingback: TechSutra : Configuring exim4 in Ubuntu to use GMail for SMTP

  4. Christopher says:

    Works great! Note: The last part (authenticator) must be placed in the authenticator section.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>