Using ssmtp to send mail using gmail.

2011-02-19 1 min read Fedora Linux

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
comments powered by Disqus