My words on free/open source software

Wednesday, March 21, 2007

Use Exim with Gmail SMTP on Fedora

I've managed to setup Exim to send mail via Gmail SMTP on my laptop running Fedora Core 6. It was a bit tough work, for I can't find any precedent of using it on Fedora. Most talkings and guides regards Exim were based on Debian, and Fedora just doesn't have that config tools of Debian.

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 "", which was got through DNS lookup, rather than the "" set by me. So in the configure file, you should use "" instead of ""

So what to do is: edit "/etc/exim/exim.conf", add:

# routers section
driver = manualroute
domains = ! +local_domains
transport = gmail_smtp
route_list = *

# transports section
driver = smtp
port = 587
hosts_require_auth =
hosts_require_tls =

# authenticators section
driver = plaintext
public_name = LOGIN
client_send = : : 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 [] 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.


Brian Lakstins said...

This also works on OpenSUSE 11 and was the easiest way I found to send email through gmail. Thank you Yan Li!

laquack said...

I had problems setting up postfix and used exim instead...this bug is really confusing people.Thanks for the advice.

ANEESH said...

Hey Yan,

How to track the mail which is sent to gmail. Because, I set up the relay serer as gmail as u mentined, but i couldnt trace anything in the logs, or in the exim queue.. Neither the mail comes to my inbox...

[root@www ~]# mail -s "Hello World"
Cc: .
Null message body; hope that's ok
[root@www ~]#
[root@www ~]# tail -f /var/log/exim/main.log

2012-01-01 19:07:06 exim 4.63 daemon started: pid=26067, -q1h, listening for SMTP on []:25 []:587 [::1]:25 [::1]:587 and for SMTPS on []:465 [::1]:465
2012-01-01 19:07:06 Start queue run: pid=26068
2012-01-01 19:07:06 End queue run: pid=26068

[root@www ~]#
[root@www ~]# exim -bpc
[root@www ~]#

Can u help me on this???

Thanks much !!

ANEESH said...

Hey Yan,

I fixed it !!

2 things to remember.

1. Add proper firewall rule to connect to the smtp server or swith off the firewall for testing..

2. The 'mail' command was invoking my old sendmail binary even though it was in disabled status. I moved it to temp and created a symbolic link for the same and the issue got fixed !!

2012-01-01 20:20:48 1RhKOp-00072q-Cu [] Connection refused
2012-01-01 20:20:48 1RhKOp-00072q-Cu == R=send_via_gmail T=gmail_smtp defer (111): Connection refused
2012-01-01 20:23:00 Start queue run: pid=27096 -qff
2012-01-01 20:23:08 1RhKOp-00072q-Cu => R=send_via_gmail T=gmail_smtp [] X=TLSv1:RC4-SHA:128
2012-01-01 20:23:08 1RhKOp-00072q-Cu Completed

Also I tried with the smtp settings, port 587

This is also working as expected.
Kudooos !!


About Me

My photo
Santa Cruz, California, United States