HowTo: Configure Sendmail with Gmail SMTP Server in FreeBSD

25Feb08

Yeah! Finally I was able to send and receive email with sendmail and dovecot implemented on my FreeBSD server. 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’)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/authinfo file and with this codes.

AuthInfo:smtp.gmail.com “U:smmsp” “I:gmailusername” “P:gmailpassword” “M:PLAIN”
AuthInfo:smtp.gmail.com:587 “U:smmsp” “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 install 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/

Advertisements


7 Responses to “HowTo: Configure Sendmail with Gmail SMTP Server in FreeBSD”

  1. 1 piju

    i still dont know how to setup sendmail for my local networks

  2. Good website …from kulhari group..manish kumar.

    Thanks

  3. 3 Ricardo Marinho

    Great work!!

  4. Nice manual but I have a problem with my sendmail.
    Error massage is:

    Starting: sendmail554 5.0.0 /etc/mail/sendmail.cf: line 59: unknown configuration line ”

    554 5.0.0 /etc/mail/sendmail.cf: line 85: unknown configuration line ”

    Warning: Option: AuthMechanisms requires SASL support (-DSASL)
    Warning: Option: AuthOptions requires SASL support (-DSASL)
    sendmail-clientmqueue.

  5. Thank you very much for this. I didn’t have luck getting sendmail to work with my Uverse SMTP, but this worked great to get my mail sending via Gmail.

  6. Thanks for the useful post like this C I had fun reading it! I always love your blog. Have a good day!

  7. I configured as everything correctly.. But I got this “Authentication Required” error

    —– Transcript of session follows —–
    … while talking to smtp.gmail.com:
    >>> AUTH dialogue
    <<< 535-5.7.1 Username and Password not accepted. Learn more at
    <<>> MAIL From: SIZE=538 AUTH=
    <<< 530-5.5.1 Authentication Required. Learn more at
    <<< 530 5.5.1 http://mail.google.com/support/bin/answer.py?answer=14257 i7sm28108408qap.12
    554 5.0.0 Service unavailable


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: