Using Sendmail as smarthost with User Authentication

  • Check whether the SMTP port number is open on the intended SMTP server or not by giving the following command:

telnet smtp.gmail.com 25


  • Now lets start with configuring sendmail to use SMARTHOSTS. In /etc/mail/sendmail.mc file add the following:

define(`SMART_HOST’,`smtp.gmail.com’)

# This defines what server we are going to use as a SMARTHOST.

  • Now the next step is to add the user authentication which is required by your SMTP server. To do this, we need to add the following to the /etc/mail/access file:

AuthInfo:smtp.gmail.com “U:<username>” “P:<password>” “M:PLAIN”


  • I then changed the permissions to the file since I had my plaintext password in it:

chmod 660 /etc/mail/access


  • Now issue the make command & restart sendmail by /etc/init.d/sendmail restart
  • What you can do now, is set up all of your mail clients to point to the linux sendmail server as your outgoing mail server and it will forward all of your emails to gmail.com and then on to it’s destination.

Leave a Reply

Your email address will not be published. Required fields are marked *