My words on free/open source software

Showing posts with label gmail. Show all posts
Showing posts with label gmail. Show all posts

Tuesday, August 14, 2007

Gmail, Fetchmail and Sendmail on UNIX/Linux

Linux Home Automation hosts a good article, Linux, Sendmail and Gmail.com on how to configure sendmail to work with Gmail. My config is a bit simpler than his (tested on Fedora Core 4, 6, Red Hat Enterprise Linux 5, CentOS 5, should work on most modern Linux distros).

My fetchmail run control file (.fetchmailrc):
 
set syslog
poll pop.gmail.com with proto POP3 and options no dns
user 'abc@gmail.com'
pass "WriteYourPasswordHere"
ssl


Modification to sendmail's mc file (/etc/mail/sendmail.mc):

define(`SMART_HOST',`smtp.gmail.com')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl


To generate the authinfo file used above, refer to
Linux, Sendmail and Gmail.com. It's very simple and you can done it within 3 minutes.

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 "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.

About Me

My photo
Santa Cruz, California, United States