{"id":4613,"date":"2015-04-26T19:19:59","date_gmt":"2015-04-26T11:19:59","guid":{"rendered":"http:\/\/rmohan.com\/?p=4613"},"modified":"2015-04-26T19:20:16","modified_gmt":"2015-04-26T11:20:16","slug":"setting-up-ssmtp-with-gmail","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=4613","title":{"rendered":"Setting up sSMTP with GMail"},"content":{"rendered":"<p>Let me introduce you to the \u201cextremely simple MTA to get mail off the system to a mailhub\u201d. Particularly useful when you don\u2019t want systems to have a full blown MTA installed. Such as Postfix, Exim or Sendmail. I find ssmtp extremely helpful on standalone servers that use Logwatch.<\/p>\n<p>Getting this up and running requires 4 steps.<\/p>\n<ul>\n<li>Installing SSMTP<\/li>\n<li>Configuring SSMTP<\/li>\n<li>Changing the MTA on your system<\/li>\n<li>Testing<\/li>\n<\/ul>\n<h2>Installing the daemon, ssmtp.<\/h2>\n<p>Use your favorite package manager, in my example I\u2019ll be using YUM. (Fedora\/CentOS\/RHEL\/Scientific Linux). For Centos\/RHEL\/Scientific Linux 5.5 or 5.6 you need access to the EPEL repository to install sSMTP. Add EPEL to your system using the following command.<\/p>\n<pre>rpm -Uvh http:\/\/download.fedora.redhat.com\/pub\/epel\/5\/i386\/epel-release-5-4.noarch.rpm<\/pre>\n<p>You can find eventual new links from <a href=\"http:\/\/download.fedora.redhat.com\/pub\/epel\/5\/i386\/repoview\/epel-release.html\">http:\/\/download.fedora.redhat.com\/pub\/epel\/5\/i386\/repoview\/epel-release.html<\/a><\/p>\n<pre>yum install ssmtp<\/pre>\n<h2>Configuring SSMTP<\/h2>\n<p>Edit \/etc\/ssmtp\/ssmtp.conf with your favorite text editor. I\u2019ll be using nano.<\/p>\n<pre>nano \/etc\/ssmtp\/ssmtp.conf<\/pre>\n<p>Remove all the entries and replace it with the ones beneath.<\/p>\n<pre>root=insert_your_email_address here\r\nmailhub=smtp.gmail.com:587\r\nUseTLS=YES\r\nUseSTARTTLS=YES\r\nAuthUser=your_gmail_username_which_you'll_be_using_to_send\r\nAuthPass=password<\/pre>\n<h2>Changing the MTA<\/h2>\n<p>For CentOS\/Fedora\/RHEL<\/p>\n<pre>alternatives --config mta<\/pre>\n<p>Press the number that equals \/usr\/sbin\/sendmail.ssmtp and you\u2019re done.<\/p>\n<h2>Testing<\/h2>\n<p>I\u2019m testing this using the verbose mode just to be able to see the dialogue with the Google SMTP server.<\/p>\n<pre>cat random_file | sendmail -v your_email_address<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Let me introduce you to the \u201cextremely simple MTA to get mail off the system to a mailhub\u201d. Particularly useful when you don\u2019t want systems to have a full blown MTA installed. Such as Postfix, Exim or Sendmail. I find ssmtp extremely helpful on standalone servers that use Logwatch.<\/p>\n<p>Getting this up and running requires [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4,29],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4613"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4613"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4613\/revisions"}],"predecessor-version":[{"id":4614,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4613\/revisions\/4614"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4613"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4613"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4613"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}