From f9739ed3426b7bf558450d0463e2139a98b5c5c9 Mon Sep 17 00:00:00 2001 From: Christoph Galuschka Date: Dec 01 2012 20:41:22 +0000 Subject: Merge remote branch 'origin/master' --- diff --git a/tests/p_sendmail/20_sendmail_mta.sh b/tests/p_sendmail/20_sendmail_mta.sh new file mode 100755 index 0000000..69a5c38 --- /dev/null +++ b/tests/p_sendmail/20_sendmail_mta.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - sendmail can accept and deliver local email." + +MAILSPOOL=/var/spool/mail/root + +# make shure spool file is empty +cat /dev/null > $MAILSPOOL +ret_val=1 + +# send mail to localhost +echo -e "helo localhost\nmail from: root@localhost\nrcpt to: root@localhost\ndata\nt_functional test\n.\nquit\n" | nc -w 5 localhost 25 | grep -q "250 2.0.0" +if [ $? = 0 ] + then + t_Log 'Mail has been queued successfully' + MTA_ACCEPT=0 +fi + +sleep 1 +grep -q 't_functional test' $MAILSPOOL +if [ $? = 0 ] + then + t_Log 'previously sent mail is in '$MAILSPOOL + SPOOLFILE=0 +fi + +if ([ $MTA_ACCEPT = 0 ] && [ $SPOOLFILE = 0 ]) + then + ret_val=0 +fi + +t_CheckExitStatus $ret_val +