#!/usr/bin/bash adduser --shell /bin/bash --disabled-password --gecos "" mtatest echo "test message" | sendmail -t mtatest@example.com sleep 1 ## simple test if mail passes if [ -f /var/mail/mtatest ] ; then echo "success" rm /var/mail/mtatest else echo "failure" exit 1 fi ## test encryption ## bob@example.com has an authenticated certificate in ## the cert store echo "test message" | sendmail -t bob@example.com sleep 1 if [ -f /var/mail/bob ] ; then if grep -q "BEGIN PGP MESSAGE" /var/mail/bob ; then echo "encryption test: success" else echo "encryption test: failure" exit 1 fi else echo "failure: mail didn't pass" exit 1 fi ## test encryption 2 ## alice@example.com has a certificate in the cert store, but ## it is not authenticated -> this should fail echo "test message" | sendmail -t alice@example.com sleep 1 if [ -f /var/mail/alice ] ; then if grep -q "BEGIN PGP MESSAGE" /var/mail/alice ; then echo "encryption test 2: failure" exit 1 else echo "encryption test 2: success" fi else echo "failure: mail didn't pass" exit 1 fi