It was a real PITA to get sendmail to cooperate with sending via a secure SMPT relay. I found instructions on several websites that resulted in a 95% solution.
First you will need to install sendmail-cf. It is a separate package the is require to modify recompile the sendmail config.
dnl# This is the default sendmail .mc file for Slackware. To generate
include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
VERSIONID(`Linux Home Automation FC6 Gmail')dnl
OSTYPE(`linux')dnl
define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
define(`confTO_IDENT', `0')dnl
FEATURE(`use_cw_file')dnl
FEATURE(`use_ct_file')dnl
FEATURE(`mailertable',`hash -o /etc/mail/mailertable.db')dnl
FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable.db')dnl
FEATURE(`access_db', `hash -T /etc/mail/access')dnl
FEATURE(`blacklist_recipients')dnl
FEATURE(`local_procmail',`',`procmail -t -Y -a $h -d $u')dnl
dnl FEATURE(`always_add_domain')dnl
FEATURE(`redirect')dnl
EXPOSED_USER(`root')dnl
FEATURE(`authinfo',`hash /etc/mail/authinfo')dnl
LOCAL_DOMAIN(`yourlocaldomainhere.com')dnl
define(`SMART_HOST',`smtp.gmail.com')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')
define(`ESMTP_MAILER_ARGS', `TCP $h 587')
dnl#
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
dnl#
define(`confCACERT_PATH', `/etc/pki/tls/certs')
define(`confCACERT', `/etc/pki/tls/certs/ca-bundle.crt')
define(`confSERVER_CERT', `/etc/pki/tls/certs/sendmail.pem')
define(`confSERVER_KEY', `/etc/pki/tls/certs/sendmail.pem')
define(`confCLIENT_CERT', `/etc/pki/tls/certs/sendmail.pem')
define(`confCLIENT_KEY', `/etc/pki/tls/certs/sendmail.pem')
dnl #
dnl # masquerade not just the headers, but the envelope as well
dnl #
FEATURE(masquerade_envelope)dnl
dnl #
dnl # masquerade not just @mydomainalias.com, but @*.mydomainalias.com as well
dnl #
dnl FEATURE(masquerade_entire_domain)dnl
dnl #
MASQUERADE_AS(`yourdomain.com') dnl
FEATURE(genericstable, `hash -o /etc/mail/genericstable') dnl
dnl GENERICS_DOMAIN_FILE(`/etc/mail/genericsdomain')dnl
dnl #
dnl # Leave these at the end, sendmail prefers these last (for the most part)
dnl #
MAILER(local)dnl
MAILER(smtp)dnl
MAILER(procmail)dnl
Rebuild the csendmail.cf with m4 sendmail.mc > sendmail.cf
You will need to create /etc/mail/authinfo.
AuthInfo:smtp.gmail.com "U:smmsp" "I:username" "P:mysecret" "M:PLAIN"
AuthInfo:smtp.gmail.com:587 "U:smmsp" "I:username" "P:mysecret" "M:PLAIN"
This is built into authinfo.db with makemap hash /etc/mail/authinfo < /etc/mail/authinfo
Be sure to chmod o-rx /etc/mail/authinfo
.
You will also want to edit /etc/mail/local-host-names to include your hostname.
At this point you should be able to mail outside the system using sendmail and the gmail SMTP servers.