12 January 2010

Linux, Sendmail and Gmail.com

i have tested this on Fedora code 7 only

Add these lines just before MAILER in the file "/etc/mail/sendmail.mc"
dnl
FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl
LOCAL_DOMAIN(`cookie.uucp')dnl
define(`SMART_HOST',`smtp.gmail.com')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')
define(`ESMTP_MAILER_ARGS', `TCP $h 587')
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`CERT_DIR', `MAIL_SETTINGS_DIR`'certs')dnl
define(`confCACERT_PATH', `CERT_DIR')dnl
define(`confCACERT', `CERT_DIR/CAcert.pem')dnl
define(`confSERVER_CERT', `CERT_DIR/mycert.pem')dnl
define(`confSERVER_KEY', `CERT_DIR/mykey.pem')dnl
define(`confCLIENT_CERT', `CERT_DIR/mycert.pem')dnl
define(`confCLIENT_KEY', `CERT_DIR/mykey.pem')dnl
FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl
MASQUERADE_AS(`comcast.net') dnl
FEATURE(genericstable, `hash -o /etc/mail/genericstable') dnl
GENERICS_DOMAIN_FILE(`/etc/mail/genericsdomain')dnl
MAILER(local)dnl
dnl

mkdir /etc/mail/auth
touch /etc/mail/auth/client-info
chmod 700 /etc/mail/auth
chmod 600 /etc/mail/auth/client-info

update "/etc/mail/auth/client-info" with
AuthInfo:smtp.gmail.com "U:smmsp" "I:USER_ID" "P:PASSWD" "M:PLAIN"
AuthInfo:smtp.gmail.com:587 "U:smmsp" "I:USER_ID" "P:PASSWD" "M:PLAIN"

cd /etc/mail/auth
makemap -r hash client-info.db < client-info
make -C /etc/mail
echo "cookie!cookie!asterisk humble@testing.com" >/etc/mail/genericsdomain
service restart sendmail

echo "test mail contents" > ~/1
mail -s "Test Mail" MyMail@Domail.com < ~/1

mailq

Referance:
http://www.linuxha.com/other/sendmail/gmail.html
http://www.notesbit.com/index.php/scripts-unix/linux-sendmail-automation-and-comcast-net-how-to-setup

No comments:

Post a Comment