#!/bin/sh
# $Id: t-many-rcpts-0.sh,v 1.1 2007/10/19 02:19:49 ca Exp $
#
# ----------------------------------------
# test many recipients
# uses smtp1.sh
# ----------------------------------------
#
test -s stop && exit 1
#

SD=`dirname $0`
if test "${SD}" = "."
then
   SD=../chkmts
fi
. ${SD}/common.sh
I=""
ERRS=0
SKIP=""

if test X"`uname`" != "XOSF1"
then
while getopts s:V FLAG
do
  case "${FLAG}" in
    s) SKIP="${SKIP} ${OPTARG}";;
    V) VERBOSE=true;;
  esac
done
shift `expr ${OPTIND} - 1`
fi

# cd to right directory (where the programs will be executed).
cd ../qmgr || exit 1
rm -f ${MTMAP}

TEST=1
# ----------------------------------------
# 
if echo "${SKIP} X" | ${GREP} -v " ${TEST} " > /dev/null
then
S='SENDER00@00000000.wiz.xy'
R=''
R="$R -R00a00000@00000000.wiz.xy"
R="$R -R01a11111111111@utanot.xy"
R="$R -R02a222222222222@utanot.xy"
R="$R -R03a33@aon.xy"
R="$R -R04a444444_knoll@abcde.tld"
R="$R -R05a@abcdefgh-abcdef.xy"
R="$R -R06a6666666666666-666666@abcdefgh-abcdef.xy"
R="$R -R07a777777777777777-777777@abcdefgh-abcdef.xy"
R="$R -R08a888888888888888@notmail.tld"
R="$R -R09a9999999999999@cdefgh.xy"
R="$R -R10a00000000000@cdefgh.xy"
R="$R -R11a111111111@kabsi.xy"
R="$R -R12a22222222222@efghhijkl.not"
R="$R -R13a33333333@notmail.tld"
R="$R -R14a44444444444@xyz.not"
R="$R -R15a5555@kabsi.xy"
R="$R -R16a666666666666@aon.xy"
R="$R -R17a77777777777@aon.xy"
R="$R -R18a88888888888@aon.xy"
R="$R -R19a99@aon.xy"
R="$R -R20a00000Keinz@vbw.xy"
R="$R -R21a11@xyz.xy"
R="$R -R22a22222222@cdefgh.xy"
R="$R -R23a333333333@xyz.xy"
R="$R -R24a444444@staar.xy"
R="$R -R25a55555555555555@cdefgh.xy"
R="$R -R26a66666@aon.xy"
R="$R -R27a7777@unterreiner.xy"
R="$R -R28a888@00000000.wiz.xy"
R="$R -R29a9999@kabsi.xy"
R="$R -R30a0000@martinides.de"
R="$R -R31a1111111@utanot.xy"
R="$R -R32a2222222222@aon.xy"
R="$R -R33a333333@eriks.xy"
R="$R -R34a444444444@a12345.xy"
R="$R -R35a55555@xyz.zh"
R="$R -R36a66666666@aon.xy"
R="$R -R37a777777777@cdefgh.xy"
R="$R -R38a88888888888@rambler.ru"
R="$R -R39a9999999@xyz.xy"
R="$R -R40a00000000@inode.xy"

# create mailertable
${CAT} > ${MT} <<EOF
aon.xy	[127.0.0.1]
cdefgh.xy	[127.0.0.1]
efghhijkl.not	[127.0.0.1]
eriks.xy	[127.0.0.1]
xyz.xy	[127.0.0.1]
xyz.zh	[127.0.0.1]
xyz.not	[127.0.0.1]
notmail.tld	[127.0.0.1]
inode.xy	[127.0.0.1]
kabsi.xy	[127.0.0.1]
abcdefgh-abcdef.xy	[127.0.0.1]
martinides.de	[127.0.0.1]
rambler.ru	[127.0.0.1]
staar.xy	[127.0.0.1]
unterreiner.xy	[127.0.0.1]
utanot.xy	[127.0.0.1]
vbw.xy	[127.0.0.1]
a12345.xy	[127.0.0.1]
00000000.wiz.xy	[127.0.0.1]
abcde.tld	[127.0.0.1]
EOF

if ${SHELL} ${SD}/smtp1.sh $@ -E 41 -A 1 -X 1 -S"$S" $R
then
    ${VERBOSE} && echo "test ${TEST} succeeded"
else
    echo "$0: test ${TEST} failed"
    ERRS=`expr ${ERRS} + 1 `
    test X"${MTA_STOPONERROR}" != X && exit 1
fi
fi


# ----------------------------------------
# end
if test "${ERRS}" = "0"
then
  rm -f ${EDBROK}
  exit 0
else
  echo "${ERRS} error(s)"
  exit 1
fi


syntax highlighted by Code2HTML, v. 0.9.1