If you want to use GMAIL as your sendmail relay server, Use the below configuration.
{I required it to send DMASOFTLAB RADIUS MANAGER Email notifications to all users regarding there service status, account expiry, renewal , various alerts and other info. thats why I wrote this guide, it maybe useful for others too . . Syed Jahanzaib }
OS Used: Ubuntu 10.4
First install Sendmail and its utilities.
apt-get install sendmail mailutils
Now configure signed SSL certificates
mkdir /etc/mail/certs
chmod 700 /etc/mail/certs
cd /etc/mail/certs
openssl dsaparam 1024 -out dsa1024 -out dsa1024.pem
(It will ask you various questiosn , just enter them accordingly, like country code, for Pakistan its PK, and other information you have)
openssl req -x509 -nodes -days 3650 -newkey dsa:dsa1024.pem -out /etc/mail/certs/mycert.pem -keyout /etc/mail/certs/mykey.pem
(It will ask you various questiosn , just enter them accordingly, like country code, for Pakistan its PK, and other information you have)
openssl req -x509 -new -days 3650 -key /etc/mail/certs/mykey.pem -out /etc/mail/certs/mycert.pem
ln -s /etc/mail/certs/mycert.pem /etc/mail/certs/CAcert.pem
chmod 600 /etc/mail/certs/*
cd ..
AuthInfo:smtp.gmail.com "U:root" "I:USERNAME@gmail.com" "P:PASSWORD" AuthInfo: "U:root" "I:USERNAME@gmail.com" "P:PASSWORD"
Save & Exit & issue below command
dnl # dnl # SSL Settings define(`CERT_DIR', `MAIL_SETTINGS_DIR`'certs') define(`confCACERT_PATH', `CERT_DIR') define(`confCACERT', `CERT_DIR/CAcert.pem') define(`confSERVER_CERT', `CERT_DIR/mycert.pem') define(`confSERVER_KEY', `CERT_DIR/mykey.pem') define(`confCLIENT_CERT', `CERT_DIR/mycert.pem') define(`confCLIENT_KEY', `CERT_DIR/mykey.pem') dnl # dnl # GMAIL FORWARDING define(`SMART_HOST',`[smtp.gmail.com]')dnl define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl define(`confAUTH_OPTIONS', `A p')dnl TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl FEATURE(`authinfo',`hash -o /etc/mail/authinfo.db')dnl
Now rebuild sendmail config and start the service
make -C /etc/mail
service sendmail restart
Test the setup
Use the below command to test the local smtp .
- - - - -??
Regard's
Syed Jahanzaib
Filed under: Linux Related