HowTo: Configure Sendmail with Gmail SMTP Server on Linux

Posted on 03. Mar, 2008 by sabin in Linux

Yeah! Finally I’m able to send and receive email with sendmail and dovecot implemented on my Linux server today. I choose gmail smtp server to act as my Outgoing Email Server. Here is how I did,

In the /etc/mail/yourhostname.mc file, add the following above the DAEMON_OPTIONS line.

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.db’)dnl
define(`SMART_HOST’, `smtp.gmail.com’)dnl
define(`RELAY_MAILER_ARGS’, `TCP $h 587′)
define(`ESMTP_MAILER_ARGS’, `TCP $h 587′)

Create or edit the /etc/mail/authinfo file and with this codes.

AuthInfo:smtp.gmail.com “U:root” “I:gmailusername” “P:gmailpassword” “M:PLAIN”
AuthInfo:smtp.gmail.com:587 “U:root” “I:gmailusername” “P:gmailpassword” “M:PLAIN”

Now, we can run this command in the /etc/mail directory.

touch local-host-names
makemap -r hash authinfo.db < authinfo
make all

service sendmail restart

If the “make all install restart” command didn’t work, you can also run “make” alternatively.

References:

http://www.linuxha.com/

http://rajasuperman.blogspot.com/

http://www.openaddict.com/

Leave a Reply