1. Create a Sendmail Certificate
CD/etc/SSL/certs/MakeSendmail. pem
2. Add authinfo to/etc/mail/access.
Authinfo: smtp.gmail.com "u: Root" I: User@gmail.com "P: Password" M: Plain "authinfo: smtp.gmail.com:587"U: Root" "I: User@gmail.com" "P: Password" "M: Plain"
Generate Database
Makemap-r hash/etc/mail/access. DB </etc/mail/Access
3. Configure smarthost to edit/etc/mail/sendmail. MC and add
Feature ('authinfo ' , 'Hash/etc/mail/access. DB ' ) Dnldefine ('smart _ host ' , 'Smtp .gmail.com ' ) Dnldefine ('relay _ mailer_args ' , 'Tcp $ H 587 ' ) Define ('esmtp _ mailer_args ' , 'Tcp $ H 587 ' ) Define ('cert _ DIR ' , '/Etc/SSL/certs ' ) Define ('confcacert _ path ' , 'Cert _ DIR ' ) Define ('confcacert ' , 'Cert _ DIR/ca-bundle.crt ' ) Define ('confcrl ' , 'Cert _ DIR/ca-bundle.crt ' ) Define ('confserver _ Cert ' , 'Cert _ DIR/sendmail. pem ' ) Define ('confserver _ key ' , 'Cert _ DIR/sendmail. pem ' ) Define ('confclient _ Cert ' , 'Cert _ DIR/sendmail. pem ' ) Define ('confclient _ key ' , 'Cert _ DIR/sendmail. pem ' ) Define ('confauth _ mechanisms ' , 'External gssapi DIGEST-MD5 CRAM-MD5 login Plain ' ) Trust_auth_mech ('external Digest -MD5 CRAM-MD5 login Plain ' )
Write to sendmail. cf
M4 sendmail. MC> sendmail. cf
4. Restart the sendmail service.
Service Sendmail restart
Reference address:
Http://appgirl.net/blog/2009/configuring-sendmail-to-relay-through-gmail-smtp/
Http://tech.bluesmoon.info/2008/03/gmail-smtp-with-sendmail.html