Postfix configuration

To reconfigure:

sudo dpkg-reconfigure postfix

To check config/manual edit:

emacs /etc/postfix/main.cf

Reloading config:

/etc/init.d/postfix reload

Testing email send (You need mutt installed):

#!/bin/bash
mailsen () {
    SUB="$1"
    BODY=$2
    echo $BODY | mutt -a $BDIR/$COMPLOG -s $SUB -- $RECI
    echo "Send mail test done"
}
touch /tmp/testmail
echo "Testing" >> /tmp/testmail
#RECI="[email protected]"
RECI="[email protected]"
# BDIR=~/"backups"
BDIR="/tmp"
COMPLOG="testmail"
mailsen "Backup"
 # done Your backup on r2d2 is over, and the log file is attached"

Checking logs whether mail was sent successfully:

tac /var/log/mail.info | less

You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.