Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

How do I tweak sendmail.cf directly (without going through m4 or .mc files) to make gmail (with SMTP AUTH) my smart relay? Notes:

  • With Comcast, I just put "DSsmtp.comcast.net" in sendmail.cf, since they authenticate by IP, and don't require "SMTP AUTH"

  • I'm now w/ Qwest, and want to use gmail's SMTP AUTH server. I realize I could use smtp.q.com, but prefer gmail's.

  • I've confirmed I can send email using gmail's server:

    > openssl s_client -connect smtp.gmail.com:465

    [... lots of certificate stuff ...]

    220 mx.google.com ESMTP y7sm198769pbg.43 
    250-mx.google.com at your service, [xxx.xxx.xxx.xxx] 
    250-SIZE 35882577 
    auth plain AGNhcnRlci5iYXJyeQxxxxxxxxxx 
    235 2.7.0 Accepted 
    mail from:  
    250 2.1.0 OK y7sm198769pbg.43 
    rcpt to:  
    250 2.1.5 OK y7sm198769pbg.43 
    354  Go ahead y7sm198769pbg.43 
    Subject: Hi there 

    End of message 

  • Based on the above, the sendmail changes I need are:

    • connect on port 465, not port 25 (although port 25 w/ STARTTLS also works)

    • connect using SSL

    • Send "auth plain AGNhcnRlci5iYXJyeQxxxxxxxxxx" after ehlo and before rcpt.

  • I know that tweaking the mc file and running m4 is the correct way to do this, but my .cf file is hand-customized and quite fragile, so I'm hoping to avoid that.

  • I realize I could have sendmail deliver to localhost:26 and have a Perl script running there that relays to smtp.gmail.com:465 using openssl (and passes data as is, except for the "AUTH PLAIN" line), but this seems ugly.

Other solutions appreciated. EG, if anyone knows of a free open relay...

share|improve this question
Why do you want to directly edit the .cf ? Have you lost the .mc and cannot recreate it? –  adamo May 1 '11 at 18:45
That's correct. I've edited sendmail.cf by hand quite a lot, so the mc file I have is not even close to the cf file. –  barrycarter May 2 '11 at 4:03
If you've documented your edits, it is possible that one can produce a working .mc that does what you want. –  adamo May 2 '11 at 5:15
I haven't (this sendmail.cf file started in 1997), but that is an idea... try to recreate my sendmail.cf by tweaking foo.mc until the resulting foo.cf matches. I may try this or just find a non-free-but-cheap POP-before-SMTP server I can use. –  barrycarter May 2 '11 at 16:35
Hm... poprelay.sourceforge.net –  adamo May 2 '11 at 17:35

1 Answer 1

Is it imperative to use Google's smtp as a relay? If not, maybe this article can help.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.