If you just want to know what to do, skip this paragraph, which talks theoratical things. My work started by following Use Gmail as a Smart Host, but it doesn't work. Checked Exim's log I found that the connection to Gmail's SMTP server was rejected, because Exim had been trying to connect to port 25 of it. Add a line "port = 587" solved this problem. Another problem is about the TLS authentication, because Exim thought the server it were to connect is called "gmail-smtp.l.google.com", which was got through DNS lookup, rather than the "smtp.gmail.com" set by me. So in the configure file, you should use "gmail-smtp.l.google.com" instead of "smtp.gmail.com."
So what to do is: edit "/etc/exim/exim.conf", add:
# routers section
send_via_gmail:
driver = manualroute
domains = ! +local_domains
transport = gmail_smtp
route_list = * gmail-smtp.l.google.com
# transports section
gmail_smtp:
driver = smtp
port = 587
hosts_require_auth = gmail-smtp.l.google.com
hosts_require_tls = gmail-smtp.l.google.com
# authenticators section
gmail_login:
driver = plaintext
public_name = LOGIN
client_send = : youraccount@gmail.com : yourpassword
I do think Exim should write an official FAQ regards this problem.
For some time, you may see such errors in Exim's log:
SMTP timeout while connected to gmail-smtp.l.google.com [72.14.253.109] after EHLO yourhostname: Conne
ction timed out
This is network or Gmail's problem. Want you can do is just waiting or switch to another ISP and try.