Using Gmail as Sendmail’s relay



Using Gmail as Sendmail’s relay

Comcast just started blocking port 25 at my house which caused sendmail to be unable to connect to external mail servers to deliver mail. Some people have been able to convince Comcast to open up the port for them but we weren’t so lucky. Instead, I changed sendmail to use Gmail’s SMTP server as its relay server.

Before making these changes I’d see lots of errors in /var/log/mail.log ending in stat=Deferred: Connection timed out with something similar. Trying to 

 would result in a timeout.

I found all the information on how to do this in these two articles; Yan Li’s Words: Gmail, Fetchmail and Sendmail on UNIX/Linux and Linux, Sendmail and

All of this was done on a server running Ubuntu 8.04.2 and sendmail 8.14.2.

Step 1

Edit your /etc/mail/ and add the following above the MAILER_DEFINITIONS block at the bottom. I tried putting these lines at the very bottom of the file the first time and it didn’t work. I suggest copy/pasting because the quotes are very strange.’)dnl
define( TCP $h 587′)dnl
define( TCP $h 587′)dnl
FEATURE( hash /etc/mail/auth/client-info’)dnl[/crayon]

Step 2

Create the /etc/mail/auth/client-info file by running:

Step 3

Edit /etc/mail/auth/client-info and fill it with the lines below. Replace user_id with your Gmail user id ( and password with your password. Make sure there is a blank line at the end of the file.

Step 4

Compile the client-info.db file.

Step 5

Compile update with our changes.

Step 6

Reload the sendmail configuration.

Now if you check your /var/log/mail.log you should see any queued messages being sent properly. You should see andstat=Sent. If not, make sure you didn’t miss a step above.

645 total views, no views today