Hello,
I hope nobody minds, if I post a short summary here for archives -
How to forward mails via Gmail account from CentOS 6
(I use sendmail, because haven't figured out how to setup Postfix yet):
# yum erase postfix # yum install sendmail sendmail-cf cyrus-sasl-plain cyrus-sasl-md5
# mkdir /etc/mail/auth # chmod 700 /etc/mail/auth
Create the file /etc/mail/auth/client-info:
AuthInfo:smtp.gmail.com "U:smmsp" "I:your_gmail_address" "P:your_password" "M:PLAIN" AuthInfo:smtp.gmail.com:587 "U:smmsp" "I:your_gmail_address" "P:your_password" "M:PLAIN"
# cd /etc/mail/auth # makemap -r hash client-info.db < client-info # chmod 600 client-info client-info.db
Then edit /etc/mail/sendmail.mc (most lines are there already and just need to be uncommented and edited a bit):
define(`SMART_HOST', `smtp.gmail.com')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl
define(`confCACERT_PATH', `/etc/pki/tls/certs')dnl define(`confCACERT', `/etc/pki/tls/certs/ca-bundle.crt')dnl define(`confSERVER_CERT', `/etc/pki/tls/certs/sendmail.pem')dnl define(`confSERVER_KEY', `/etc/pki/tls/certs/sendmail.pem')dnl define(`confCLIENT_CERT', `/etc/pki/tls/certs/sendmail.pem')dnl define(`confCLIENT_KEY', `/etc/pki/tls/certs/sendmail.pem')dnl
Then create certificates (I've used "DE", "NRW", "Bochum", "my hostname", "my gmail address" there as input):
# cd /etc/pki/tls/certs # make sendmail.pem
Append the following line to /etc/aliases:
root: your_gmail_address
and run "newaliases". If you need, also append "apache" to /etc/mail/trusted-users. Finally:
# cd /etc/mail # make (this will generate new sendmail.cf) # service sendmail restart
and check the /var/log/maillog for error messages while sending test mail messages from command line.
Regards Alex