# test spost: sender header

. "$MH_TEST_COMMON"

profile="$MMH/profile-spost"
cd "$MMH"
cat "`mhparam profile`" - >"$profile" <<!
default-from: Bob <bob@example.org>
alternate-mailboxes: ziggy@example.net, walther@example.net
!
cd - >/dev/null
export MMHP="$profile"

draft="$MH_TEST_DIR/spost-$$.draft"



# no from header

cat >"$draft" <<!
To: alice
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: no from header
----------------
foo
!

runandcheck 'spost -debug "$draft"' <<!
To: alice
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: no from header
From: Bob <bob@example.org>

foo
----EOM----
alice
!



# single from addr (my default one)

cat >"$draft" <<!
From: bob@example.org
To: alice
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: single from addr (my default one)
----------------
foo
!

runandcheck 'spost -debug "$draft"' <<!
From: bob@example.org
To: alice
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: single from addr (my default one)

foo
----EOM----
alice
!



# single from addr (my alternate one)

cat >"$draft" <<!
From: walther@example.net
To: alice
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: single from addr (my alternate one)
----------------
foo
!

runandcheck 'spost -debug "$draft"' <<!
From: walther@example.net
To: alice
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: single from addr (my alternate one)

foo
----EOM----
alice
!



# single from addr (a foreign one)

cat >"$draft" <<!
From: charly
To: alice
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: single from addr (a foreign one)
----------------
foo
!

runandcheck 'spost -debug "$draft"' <<!
From: charly
To: alice
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: single from addr (a foreign one)
Sender: Bob <bob@example.org>

foo
----EOM----
alice
!



# multiple from addrs (including my default addr)

cat >"$draft" <<!
From: bob@example.org, charly, jack
To: alice
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: multiple from addrs (including my default addr)
----------------
foo
!

runandcheck 'spost -debug "$draft"' <<!
From: bob@example.org, charly, jack
To: alice
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: multiple from addrs (including my default addr)
Sender: bob@example.org

foo
----EOM----
alice
!



# multiple from addrs (including my alternate addr)

cat >"$draft" <<!
From: charly, jack, walther@example.net
To: alice
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: multiple from addrs (including my alternate addr)
----------------
foo
!

runandcheck 'spost -debug "$draft"' <<!
From: charly, jack, walther@example.net
To: alice
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: multiple from addrs (including my alternate addr)
Sender: walther@example.net

foo
----EOM----
alice
!



# multiple from addrs (all foreign)

cat >"$draft" <<!
From: charly, jack, gill
To: alice
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: multiple from addrs (all foreign)
----------------
foo
!

runandcheck 'spost -debug "$draft"' <<!
From: charly, jack, gill
To: alice
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: multiple from addrs (all foreign)
Sender: Bob <bob@example.org>

foo
----EOM----
alice
!


