Configure Linux sendmail with GMAIL
1.Backup /etc/mail/sendmail.mc and /etc/mail/sendmail.cf
2.Create certs dir in /etc/mail
3.Edit sendmail.mc
Add this lines
define(`CERT_DIR', `/etc/mail/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_OPTIONS', `A')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
TRUST_AUTH_MECH(`EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo', `Hash -o /etc/mail/authinfo')dnl
define(`SMART_HOST', `smtp.gmail.com')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')
define(`ESMTP_MAILER_ARGS', `TCP $h 587')
Note: Sometime the quotes will not copy properly, check the quotes(two different quotes is there)4. Create authinfo file in /etc/mail dir
#touch authinfo
5.Copy the following commands in the authinfo file ( Replace gmail username and password)
AuthInfo:smtp.gmail.com "U:root" "I:yourid@gmail.com" "P:
AuthInfo:smtp.gmail.com:587 "U:root" "I:yourid@gmail.com" "P:
6. Go to /etc/mail/certs dir
Run these following commands to create certificates ( give appropriate values )
#openssl req -new -x509 -keyout cakey.pem -out cacert.pem -days 3650
#openssl req -nodes -new -x509 -keyout sendmail.pem -out sendmail.pem -days 3650
7. Compile sendmail.mc file using following command
#m4 sendmail.mc > sendmail.cf
8. Restart sendmail Service
#service sendmail restart
9. Check whether mails are going
#mailx -s “Test Mail” mailid@gmail.com
Test message
.
CC .
Check the log file
#tail –f /var/log/maillog
Now we can able to use this smtp relay with other application
Note:
Give smtp server name as “ localhost “ and Port 25 . it will work with localhost name only.
In Oracle Applications - We can use this . In OAM workflow mailer configuration give outbound server name “localhost” .
Then you can receive workflow notification mails, alert mails and all Apps related mails.
No comments:
Post a Comment