SSMTP

From ArchWiki
Revision as of 10:51, 19 December 2008 by Chochem (Talk | contribs) (References)

Jump to: navigation, search

Introduction

If you don't need a full blown mail server, and use Gmail for almost everything, this guide is for you. With SSMTP you can have a quick and easy way to get automated mail off your machine and to a mail hub.


Installation and Setup

To install SSMTP, you can just use Pacman:

pacman -S ssmtp


To configure SSMTP, you will have to edit the following files.

In /etc/ssmtp/ssmtp.conf enter:

root=youraccount@gmail.com
mailhub=smtp.gmail.com:587
rewriteDomain=
hostname=youraccount@gmail.com
UseSTARTTLS=YES
AuthUser=youraccount
AuthPass=yourpasword
FromLineOverride=YES

Replacing youraccount with your Google username.

Make sure to change the file permissions so that users on your system cannot see your gmail password

 chmod 600 /etc/ssmtp/ssmtp.conf

In /etc/ssmtp/revaliases enter:

root:youraccount@gmail.com:smtp.gmail.com:587
mainuser:youraccount@gmail.com:smtp.gmail.com:587


And this is it. If you want to test it, you can simply issue at the terminal prompt:

echo test | mail -s "testing ssmtp setup" USERNAME@SOMEDOMAIN.COM

Where USERNAME@SOMEDOMAIN is an address that you can check, or somebody is willing to check for you.


As an alternate method for sending emails, even using a Gmail alias, you can use a text file, using the following syntax:

To:USERNAME@SOMEDOMAIN.COM
From:youraccount@gmail.com
Subject: Test

This is a test mail.

Save it as, for example, test and then run:

ssmtp youraccount@gmail.com < test

Notice that you can use any alias email address you have on Gmail (although it doesn't seem to work with the Hotmail one I have).

Attachments

This method does not work with attachments. If you need to be able to add attachments, install and configure Mutt and Msmtp and then go see the tip at nixcraft.

References

SSMTP and Gmail on the Arch forums

Sending Email From Your System with sSMTP