If both Exim and ssmtp are running, you may run into problems. Therefore, if you just want to start a simple MTA, just for the simple smtp client to send email notifications for confirmation, first clear the pre-installed MTA, such as Exim or postfix, and reinstall ssmtp.
Then it is pretty simple, setting up only 2 files (revaliases and ssmtp.conf) - see ssmtp doc - and using in your bash or bourne script looks like this:
#!/bin/sh SUBJECT=$1 RECEIVER=$2 TEXT=$3 SERVER_NAME=$HOSTNAME SENDER=$(whoami) USER="noreply" [[ -z $1 ]] && SUBJECT="Notification from $SENDER on server $SERVER_NAME" [[ -z $2 ]] && RECEIVER="another_configured_email_address" [[ -z $3 ]] && TEXT="no text content" MAIL_TXT="Subject: $SUBJECT\nFrom: $SENDER\nTo: $RECEIVER\n\n$TEXT" echo -e $MAIL_TXT | sendmail -t exit $?
Obviously, do not forget to open the firewall output to smtp (25).
hornetbzz Mar 02 '11 at 17:53 2011-03-02 17:53
source share