Blame tests/p_sendmail/30_sendmail_mta_ehlo.sh

c57e24
#!/bin/bash
Christoph Galuschka 2a3519
# Author: Christoph Galuschka <christoph.galuschka@chello.at>
Christoph Galuschka 2a3519
Christoph Galuschka 2a3519
t_Log "Running $0 - sendmail can accept and deliver local email using ESMTP."
Christoph Galuschka 2a3519
c57e24
MAILSPOOL="/var/spool/mail/root"
Christoph Galuschka 2a3519
Christoph Galuschka 2a3519
# make shure spool file is empty
c57e24
cat /dev/null > ${MAILSPOOL}
Christoph Galuschka 2a3519
ret_val=1
Christoph Galuschka 2a3519
Christoph Galuschka 2a3519
# send mail to localhost
b76322
echo -e "ehlo localhost\nmail from: root@localhost\nrcpt to: root@localhost\ndata\nt_functional test\n.\nquit\n" | nc -4 -w 5 localhost 25 | grep -q "250 2.0.0"
c57e24
if [ "$?" = "0" ]
Christoph Galuschka 2a3519
  then
Christoph Galuschka 2a3519
  t_Log 'Mail has been queued successfully'
c57e24
  MTA_ACCEPT="0"
Christoph Galuschka 2a3519
fi
Christoph Galuschka 2a3519
c57e24
sleep 3
c57e24
grep -q 't_functional test' ${MAILSPOOL}
c57e24
if [ "$?" = "0" ]
Christoph Galuschka 2a3519
  then
c57e24
  t_Log "previously sent mail is in ${MAILSPOOL}"
c57e24
  SPOOLFILE="0"
Christoph Galuschka 2a3519
fi
Christoph Galuschka 2a3519
c57e24
if [[ "$MTA_ACCEPT" = "0" &&  "$SPOOLFILE" = "0" ]] ; then
Christoph Galuschka 2a3519
  ret_val=0
Christoph Galuschka 2a3519
fi
Christoph Galuschka 2a3519
Christoph Galuschka 2a3519
t_CheckExitStatus $ret_val
Christoph Galuschka 2a3519