Getting sendmail to use gmail as a relay.

These instructions have been updated for Ubuntu 8.10 HERE

I did this a while a go, when i was getting asterisk to forward my home voice mail to me and my wifes email address'.

Add the following to your sendmail.mc

define(`SMART_HOST',`smtp.gmail.com:465')
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl



Create the auth directory

mkdir /etc/mail/auth



create the client-info file which will contain the smtp logon credentials

create the client-info file which will contain the smtp logon credentials



Add the content

AuthInfo:smtp.gmail.com "U:root" "I:GMAILUSER@gmail.com" "P:PASSWORD"



where GMAILUSER = your gmail username and PASSWORD = your password set the permissions

chmod 600 /etc/mail/auth *



and recompile your sendmail.cf using which ever method your distro says is best (mine in ubuntu 7.04)

sendmailconfig



st and check /var/log/mail.log for errors. bish bosh wallop!

Comments

  1. There is some little thing wrong there.

    I get the error below when trying to recompile on webmin

    Failed to build configuration :

    NONE:0: m4: ERROR: end of file in argument list


    Googling it, I´ve found:

    http://www.webservertalk.com/archive58-2004-6-287491.html

    But where is the wrong tick-tick here?


    tks

    ReplyDelete
  2. There is some little thing wrong there.

    I get the error below when trying to recompile on webmin

    Failed to build configuration :

    NONE:0: m4: ERROR: end of file in argument list


    Googling it, I´ve found:

    http://www.webservertalk.com/archive58-2004-6-287491.html

    But where is the wrong tick-tick here?


    tks

    ReplyDelete
  3. Does not work for me: ubuntu 7.04, trying to relat to smtp.o2.co.uk.
    Can not get it work either with telnet smtp.o2.co.uk 25,
    get error message:
    ubu7 sm-mta[15684]: m2JKTXF1015682: SYSERR(root): hash map "authinfo": unsafe map file /etc/mail/auth/client-info.db: Permission denied

    Any suggestions?

    Eli

    ReplyDelete
  4. Does not work for me: ubuntu 7.04, trying to relat to smtp.o2.co.uk.
    Can not get it work either with telnet smtp.o2.co.uk 25,
    get error message:
    ubu7 sm-mta[15684]: m2JKTXF1015682: SYSERR(root): hash map "authinfo": unsafe map file /etc/mail/auth/client-info.db: Permission denied

    Any suggestions?

    Eli

    ReplyDelete
  5. eli, et al:

    It seems the instructions above miss a step.

    After creating the client-info file in the auth directory, you must run the following command.

    makemap -r hash client-info.db < client-info

    Then, you should continue with recompiling the sendmail.cf file.

    Hope this helps.

    ReplyDelete
  6. eli, et al:

    It seems the instructions above miss a step.

    After creating the client-info file in the auth directory, you must run the following command.

    makemap -r hash client-info.db < client-info

    Then, you should continue with recompiling the sendmail.cf file.

    Hope this helps.

    ReplyDelete
  7. Hello,

    besides the missing makemap instruction, pay attention to use traditionnal " and ' in your configuration files. If you copy paste, you will have to modify them by hand (both in client-info and sendmail.mc).

    ReplyDelete
  8. Hello,

    besides the missing makemap instruction, pay attention to use traditionnal " and ' in your configuration files. If you copy paste, you will have to modify them by hand (both in client-info and sendmail.mc).

    ReplyDelete
  9. Do we need some exact authentication/transfer protocols to be available in sendmail version maybe? How to check them?

    Sep 7 12:23:50 localhost sendmail[1593]: STARTTLS=client, relay=smtp.gmail.com, version=TLSv1/SSLv3, verify=FAIL, cipher=RC4-MD5, bits=128/128
    Sep 7 12:23:50 localhost sendmail[1593]: AUTH=client, relay=smtp.gmail.com [209.85.129.99], authinfo failed

    ReplyDelete
  10. Please have a look at the newer version of the instructions http://www.james-lloyd.com/getting-sendmail-use-gmail-as-a-relay-2/

    ReplyDelete
  11. Do we need some exact authentication/transfer protocols to be available in sendmail version maybe? How to check them?

    Sep 7 12:23:50 localhost sendmail[1593]: STARTTLS=client, relay=smtp.gmail.com, version=TLSv1/SSLv3, verify=FAIL, cipher=RC4-MD5, bits=128/128
    Sep 7 12:23:50 localhost sendmail[1593]: AUTH=client, relay=smtp.gmail.com [209.85.129.99], authinfo failed

    ReplyDelete
  12. Please have a look at the newer version of the instructions http://www.james-lloyd.com/getting-sendmail-use-gmail-as-a-relay-2/

    ReplyDelete
  13. Thank you K3nt1 for the tip. The un-traditional " in the auth file caused me the same problem. Thanks to you it's now solved :)

    ReplyDelete
  14. Thank you K3nt1 for the tip. The un-traditional " in the auth file caused me the same problem. Thanks to you it's now solved :)

    ReplyDelete
  15. [...] http://james-lloyd.com/getting-sendmail-use-gmail-as-a-relay/ [...]

    ReplyDelete

Post a Comment

Popular posts from this blog

The Beer Belly

T-Rextasy