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.
<; is required for the hosts_require_auth and hosts_require_tls lists because $host_address can contain colons (the default list separator character) when sending with IPv6.