University of Turku

SSMTP howto

SSMPT is a simple way to send email.
It is easy to ingrate some lines to scripts to handle the messages.
You can use it in a server to send alarms and status information to administrators.

There is hundreds of pages about how to install and configure SSMTP. In any case the configuration is very easy. Check /etc/ssmtp.conf.

Here is a simple example to use SSMTP.


#!/bin/bash
RECEIVER=myself@mydomain.fi
MESSAGE=/home/myself/message.txt;
SNAME=/etc/hostname;

ECHO=/bin/echo;
DATE=/bin/date;
CAT=/bin/cat;
SENDMAIL=/usr/sbin/sendmail;

$ECHO "To: $RECEIVER" > $MESSAGE;
$ECHO "Subject: My Message to Me" >> $MESSAGE;

$CAT $SNAME >> $MESSAGE;
$DATE >> $MESSAGE;
$ECHO "The work has been done. Here are the documents" >> $MESSAGE;
$CAT $VALUES.DOC >> $MESSAGE;
$CAT $MESSAGE | $SENDMAIL $RECEIVER;

PTMUSTA at UTU.FI