Skip to content
Snippets Groups Projects
test_send_email.sh 494 B
#!/bin/bash
# Criticality: High
# Check that emails can be sent
RAND="$RANDOM"
EMAIL="noreply+$RAND@ubicast.eu"
RELAY=`grep relayhost /etc/postfix/main.cf`
echo "Sending email to $EMAIL using $RELAY"
echo "This is a test email" | mail -s "Test email from `cat /etc/hostname`" $EMAIL
sleep 10
grep $EMAIL /var/log/mail.log | grep bounced > /dev/null
if [ $? -eq 0 ]; then
    echo "Sending mail failed"
    exit 1
fi
echo "Sending mail succeeded"
exit 0
# check un webservice qui recoit le mail