#!/bin/bash # DOMAIN="nstx.local" USER1="ding@$DOMAIN" USER1B="ding2@$DOMAIN" USER2="dong@$DOMAIN" USEREXT="blackhole@univention.de" SERVER="$1" PORT="$2" [ -z "$2" -o -z "$1" -o "$1" = "-h" -o "$1" = "--help" ] && echo "$(basename "$0") <25|465>" && exit 1 test_mail () { MSG="$1" shift 1 if [ "$PORT" = "25" ] ; then swaks --server "$SERVER" -tls "$@" 2>&1 SWAKS_EXITCODE="$?" else swaks --server "$SERVER" --tlsc "$@" 2>&1 SWAKS_EXITCODE="$?" fi RESULT="REJECT" [ "$SWAKS_EXITCODE" = "0" ] && RESULT="ok " echo "$RESULT | $MSG" >&2 } test_mail "$USEREXT ==> $USER1" --from "$USEREXT" --to "$USER1" test_mail "$USEREXT ==> $USER1B" --from "$USEREXT" --to "$USER1B" test_mail "$USEREXT ==> $USER2" --from "$USEREXT" --to "$USER2" test_mail "$USEREXT ==> $USEREXT" --from "$USEREXT" --to "$USEREXT" test_mail "$USER1 ==> $USER1" --from "$USER1" --to "$USER1" test_mail "$USER1 ==> $USER1B" --from "$USER1" --to "$USER1B" test_mail "$USER1 ==> $USER2" --from "$USER1" --to "$USER2" test_mail "$USER1 ==> $USEREXT" --from "$USER1" --to "$USEREXT" test_mail "$USER1B ==> $USER1" --from "$USER1B" --to "$USER1" test_mail "$USER1B ==> $USER1B" --from "$USER1B" --to "$USER1B" test_mail "$USER1B ==> $USER2" --from "$USER1B" --to "$USER2" test_mail "$USER1B ==> $USEREXT" --from "$USER1B" --to "$USEREXT" test_mail "$USER2 ==> $USER1" --from "$USER2" --to "$USER1" test_mail "$USER2 ==> $USER1B" --from "$USER2" --to "$USER1B" test_mail "$USER2 ==> $USER2" --from "$USER2" --to "$USER2" test_mail "$USER2 ==> $USEREXT" --from "$USER2" --to "$USEREXT" test_mail "AUTH $USEREXT ==> $USER1" --from "$USEREXT" --to "$USER1" --auth-user "$USEREXT" --auth-password univention test_mail "AUTH $USEREXT ==> $USER1B" --from "$USEREXT" --to "$USER1B" --auth-user "$USEREXT" --auth-password univention test_mail "AUTH $USEREXT ==> $USER2" --from "$USEREXT" --to "$USER2" --auth-user "$USEREXT" --auth-password univention test_mail "AUTH $USEREXT ==> $USEREXT" --from "$USEREXT" --to "$USEREXT" --auth-user "$USEREXT" --auth-password univention test_mail "AUTH $USER1 ==> $USER1" --from "$USER1" --to "$USER1" --auth-user "$USER1" --auth-password univention test_mail "AUTH $USER1 ==> $USER1B" --from "$USER1" --to "$USER1B" --auth-user "$USER1" --auth-password univention test_mail "AUTH $USER1 ==> $USER2" --from "$USER1" --to "$USER2" --auth-user "$USER1" --auth-password univention test_mail "AUTH $USER1 ==> $USEREXT" --from "$USER1" --to "$USEREXT" --auth-user "$USER1" --auth-password univention test_mail "AUTH $USER1B ==> $USER1" --from "$USER1B" --to "$USER1" --auth-user "$USER1B" --auth-password univention test_mail "AUTH $USER1B ==> $USER1B" --from "$USER1B" --to "$USER1B" --auth-user "$USER1B" --auth-password univention test_mail "AUTH $USER1B ==> $USER2" --from "$USER1B" --to "$USER2" --auth-user "$USER1B" --auth-password univention test_mail "AUTH $USER1B ==> $USEREXT" --from "$USER1B" --to "$USEREXT" --auth-user "$USER1B" --auth-password univention test_mail "AUTH $USER2 ==> $USER1" --from "$USER2" --to "$USER1" --auth-user "$USER2" --auth-password univention test_mail "AUTH $USER2 ==> $USER1B" --from "$USER2" --to "$USER1B" --auth-user "$USER2" --auth-password univention test_mail "AUTH $USER2 ==> $USER2" --from "$USER2" --to "$USER2" --auth-user "$USER2" --auth-password univention test_mail "AUTH $USER2 ==> $USEREXT" --from "$USER2" --to "$USEREXT" --auth-user "$USER2" --auth-password univention test_mail "AUTH as $USER1 : $USEREXT ==> $USER1" --from "$USEREXT" --to "$USER1" --auth-user "$USER1" --auth-password univention test_mail "AUTH as $USER1B : $USEREXT ==> $USER1B" --from "$USEREXT" --to "$USER1B" --auth-user "$USER1B" --auth-password univention test_mail "AUTH as $USER2 : $USEREXT ==> $USER2" --from "$USEREXT" --to "$USER2" --auth-user "$USER2" --auth-password univention test_mail "AUTH as $USEREXT : $USEREXT ==> $USEREXT" --from "$USEREXT" --to "$USEREXT" --auth-user "$USEREXT" --auth-password univention test_mail "AUTH as $USER1 : $USER1 ==> $USER1" --from "$USER1" --to "$USER1" --auth-user "$USER1" --auth-password univention test_mail "AUTH as $USER1B : $USER1 ==> $USER1B" --from "$USER1" --to "$USER1B" --auth-user "$USER1B" --auth-password univention test_mail "AUTH as $USER2 : $USER1 ==> $USER2" --from "$USER1" --to "$USER2" --auth-user "$USER2" --auth-password univention test_mail "AUTH as $USEREXT : $USER1 ==> $USEREXT" --from "$USER1" --to "$USEREXT" --auth-user "$USEREXT" --auth-password univention test_mail "AUTH as $USER1 : $USER1B ==> $USER1" --from "$USER1B" --to "$USER1" --auth-user "$USER1" --auth-password univention test_mail "AUTH as $USER1B : $USER1B ==> $USER1B" --from "$USER1B" --to "$USER1B" --auth-user "$USER1B" --auth-password univention test_mail "AUTH as $USER2 : $USER1B ==> $USER2" --from "$USER1B" --to "$USER2" --auth-user "$USER2" --auth-password univention test_mail "AUTH as $USEREXT : $USER1B ==> $USEREXT" --from "$USER1B" --to "$USEREXT" --auth-user "$USEREXT" --auth-password univention test_mail "AUTH as $USER1 : $USER2 ==> $USER1" --from "$USER2" --to "$USER1" --auth-user "$USER1" --auth-password univention test_mail "AUTH as $USER1B : $USER2 ==> $USER1B" --from "$USER2" --to "$USER1B" --auth-user "$USER1B" --auth-password univention test_mail "AUTH as $USER2 : $USER2 ==> $USER2" --from "$USER2" --to "$USER2" --auth-user "$USER2" --auth-password univention test_mail "AUTH as $USEREXT : $USER2 ==> $USEREXT" --from "$USER2" --to "$USEREXT" --auth-user "$USEREXT" --auth-password univention