#!/bin/bash
# ---------------------------------------------------------------
#  SCENARIO A - Legitimate email  (expected: FULL PASS)
# ---------------------------------------------------------------
#
#  Flow:  swaks --> sender-mta Postfix --> OpenDKIM signs --> receiver-mta
#
#  MAIL FROM: <alice@legit.lab>
#  From:      Alice <alice@legit.lab>
#  To:        bob@receiver.lab
#  DKIM:      signed d=legit.lab s=selector1
#
#  Expected results on receiver-mta:
#    SPF  = pass   (10.0.0.10 authorized for legit.lab)
#    DKIM = pass   (valid signature, d=legit.lab)
#    DMARC= pass   (From aligned with SPF + DKIM)
# ---------------------------------------------------------------

set -e

echo ""
echo "---------------------------------------------------"
echo "  SCENARIO A - Legitimate Email (Full PASS)       "
echo "---------------------------------------------------"
echo ""

swaks \
    --to bob@receiver.lab \
    --from alice@legit.lab \
    --h-From "Alice <alice@legit.lab>" \
    --h-Subject "Scenario A: Legitimate email from legit.lab" \
    --body "This is a legitimate email sent from alice@legit.lab.\nIt should pass SPF, DKIM, and DMARC checks." \
    --server 127.0.0.1 \
    --port 25 \
    --timeout 30

echo ""
echo "Scenario A sent. Check receiver-mta logs/headers for results."
echo "    Expected: spf=pass, dkim=pass, dmarc=pass"
echo ""
