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.

Tags: , ,

3 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. [...] a working setup without much trouble. But I had to piece together the content from three separate sources. Here is how I did [...]

Leave a Reply