# test spost: Group Addresses

. "$MH_TEST_COMMON"


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

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



# Group Recipients

cat >"$draft" <<!
To: Undisclosed recipients: Alice <alice@example.org>,
	Gill <gill@example.org>;
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: Group Recipients
----------------
foo
!

runandcheck 'spost -debug "$draft"' <<!
To: Undisclosed recipients: ;
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: Group Recipients
From: Bob <bob@example.org>

foo
----EOM----
alice@example.org
gill@example.org
!



cat >"$draft" <<!
To: charly@example.net
Cc: friends: alice@example.org, Gill <gill@example.org>;
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: Group in CC
----------------
foo
!

runandcheck 'spost -debug "$draft"' <<!
To: charly@example.net
Cc: friends: ;
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: Group in CC
From: Bob <bob@example.org>

foo
----EOM----
alice@example.org
gill@example.org
charly@example.net
!



cat >"$draft" <<!
To: charly@example.net
Cc: friends: alice@example.org, Gill <gill@example.org>
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: No semicolon at the end of the group
----------------
foo
!

runandcheck 'spost -debug "$draft"' <<!
To: charly@example.net
Cc: friends: ;
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: No semicolon at the end of the group
From: Bob <bob@example.org>

foo
----EOM----
alice@example.org
gill@example.org
charly@example.net
!



cat >"$draft" <<!
To: friends: Alice <alice@example.org>, Gill <gill@example.org>;,
	charly@example.net
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: Group plus address with comma
----------------
foo
!

runandcheck 'spost -debug "$draft"' <<!
To: friends: ;, charly@example.net
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: Group plus address with comma
From: Bob <bob@example.org>

foo
----EOM----
alice@example.org
gill@example.org
charly@example.net
!



cat >"$draft" <<!
To: friends: Alice <alice@example.org>, Gill <gill@example.org>;
	charly@example.net
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: Group plus address, no comma
----------------
foo
!

runandcheck 'spost -debug "$draft"' <<!
To: friends: ;, charly@example.net
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: Group plus address, no comma
From: Bob <bob@example.org>

foo
----EOM----
alice@example.org
gill@example.org
charly@example.net
!



cat >"$draft" <<!
To: abc:alice
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: One word with a colon inside
----------------
foo
!

runandcheck 'spost -debug "$draft"' <<!
To: abc: ;
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: One word with a colon inside
From: Bob <bob@example.org>

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



cat >"$draft" <<!
To: charly
Dcc: friends: Alice <alice@example.org>, Gill <gill@example.org>;
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: Group in Dcc
----------------
foo
!

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

foo
----EOM----
alice@example.org
gill@example.org
charly
!
