Using ssmtp to send mail using gmail.

2011-02-19 170 words 1 min read

First install the package ssmtp using the command:

  <td>
    <div class="text codecolorer">
      sudo yum install ssmtp
    </div>
  </td>
</tr>
1

Open the configuration file for ssmtp as root user:

  <td>
    <div class="text codecolorer">
      vim /etc/ssmtp/ssmtp.conf
    </div>
  </td>
</tr>
1

Make the following changes to the configuration file:

root=**username**@gmail.com
mailhub=smtp.gmail.com:587
hostname=**username**@gmail.com
UseSTARTTLS=YES
AuthUser=username
AuthPass=password
FromLineOverride=yes

In order to make the default (root) “from” field be the server name,
edit the /etc/ssmtp/revaliases file as root user :

  <td>
    <div class="text codecolorer">
      vi /etc/ssmtp/revaliases
    </div>
  </td>
</tr>
1

And add into it the desired translation which in our Gmail examples case
will be:

root:test@example.com:smtp.gmail.com

and time to test:

  <td>
    <div class="text codecolorer">
      echo "Amit Agarwal"|ssmtp <email id>
    </div>
  </td>
</tr>
1

If this does not work, then you can try with -v or -vv or -vvv for ssmtp command.

Enhanced by Zemanta

Related Articles:


author

Authored By Amit Agarwal

Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.

We notice you're using an adblocker. If you like our webite please keep us running by whitelisting this site in your ad blocker. We’re serving quality, related ads only. Thank you!

I've whitelisted your website.

Not now
This website uses cookies to ensure you get the best experience on our website. Learn more Got it