tests_init \
basics \
simple \
- subscribe
+ subscribe \
+ subscribe_digest \
+ subscribe_nomail
mlmmjreceive=$(command -v mlmmj-receive)
the list.\r
\r
\r
+.\r
+QUIT\r
+EOF
+ atf_check -o file:expected-5.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-5.txt
+ atf_check -s exit:1 test -f list/subscribers.d/b
+}
+
+subscribe_digest_body()
+{
+ atf_check $srcdir/fakesmtpd
+ trap kill_fakesmtp EXIT TERM
+ init_ml list
+ rmdir list/text
+ ln -s ${srcdir}/../listtexts/en list/text
+ echo test@mlmmjtest > list/control/listaddress
+ echo "25678" > list/control/smtpport
+ echo "heloname" > list/control/smtphelo
+
+ cat > subscribe << EOF
+From: bob@test
+To: test+subscribe-digest@mlmmjtest
+Return-Path: jane@test
+Subject: subscribe
+
+this is a subscribtion test
+EOF
+ atf_check $mlmmjreceive -L list -F <subscribe
+
+cat > expected-1.txt <<EOF
+EHLO heloname\r
+MAIL FROM:<test+bounces-confsub-@mlmmjtest>\r
+RCPT TO:<bob@test>\r
+DATA\r
+Subject: =?utf-8?q?Confirm_subscription_to_test=40mlmmjtest?=\r
+From: test+help@mlmmjtest\r
+To: bob@test\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: 8bit\r
+Reply-To: test+confsub-digest@mlmmjtest\r
+\r
+Hi, this is the Mlmmj program managing the <test@mlmmjtest> mailing list.\r
+\r
+Somebody (and we hope it was you) has requested that your email address\r
+<bob@test> be added to the list, to receive digests. This means you will\r
+receive multiple posts in a single mail message, at regular intervals, or\r
+when a lot of posts have accumulated.\r
+\r
+To confirm you want to do this, please send a message to\r
+<test+confsub-digest@mlmmjtest> which can usually be done\r
+simply by replying to this message. The subject and the body of the message\r
+can be anything.\r
+\r
+After doing so, you should receive a reply informing you that the operation\r
+succeeded.\r
+\r
+If you do not want to do this, simply ignore this message.\r
+\r
+\r
+.\r
+QUIT\r
+EOF
+ atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d; s/confsub-digest.*@mlmmjtest/confsub-digest@mlmmjtest/g; s/bounces-confsub-.*@mlmmjtest/bounces-confsub-@mlmmjtest/g" mail-1.txt
+ var=$(ls list/subconf)
+
+ cat > confirm << EOF
+From: bob@test
+To: test+confsub-digest-${var##*/}@mlmmjtest
+Return-Path: jane@test
+Subject: subscribe
+
+this is a subscribtion test
+EOF
+ atf_check $mlmmjreceive -L list -F <confirm
+ cat > expected-2.txt <<EOF
+EHLO heloname\r
+MAIL FROM:<test+bounces-help@mlmmjtest>\r
+RCPT TO:<bob@test>\r
+DATA\r
+Subject: =?utf-8?q?Welcome_to_test=40mlmmjtest?=\r
+From: test+help@mlmmjtest\r
+To: bob@test\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: 8bit\r
+\r
+Hi, this is the Mlmmj program managing the <test@mlmmjtest> mailing list.\r
+\r
+Thank you for confirming your subscription. You have now been added to the\r
+digest version of the list.\r
+\r
+The email address you are subscribed with is <bob@test>.\r
+\r
+If you ever wish to unsubscribe, send a message to\r
+<test+unsubscribe@mlmmjtest> using this email address. The subject and the\r
+body of the message can be anything. You will then receive confirmation or\r
+further instructions.\r
+\r
+For other information and help about this list, send a message to\r
+<test+help@mlmmjtest>.\r
+\r
+\r
+.\r
+QUIT\r
+EOF
+ atf_check -o file:expected-2.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-2.txt
+ atf_check -o inline:"bob@test\n" cat list/digesters.d/b
+ atf_check -s exit:1 test -f list/subconf/${var}
+
+# second confirmation
+ atf_check $mlmmjreceive -L list -F <confirm
+ atf_check -s exit:1 test -f mail-3.txt
+ cat > expected-3.txt << EOF
+EHLO heloname\r
+MAIL FROM:<test+bounces-help@mlmmjtest>\r
+RCPT TO:<bob@test>\r
+DATA\r
+Subject: =?utf-8?q?Unable_to_subscribe_to_test=40mlmmjtest?=\r
+From: test+help@mlmmjtest\r
+To: bob@test\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: 8bit\r
+\r
+Hi, this is the Mlmmj program managing the <test@mlmmjtest> mailing list.\r
+\r
+You were unable to be subscribed to the list because you are already\r
+subscribed.\r
+\r
+\r
+.\r
+QUIT\r
+EOF
+ # New subscribtion
+ atf_check $mlmmjreceive -L list -F <subscribe
+ atf_check -o file:expected-3.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-3.txt
+
+ cat > unsubscribe <<EOF
+From: bob@test
+To: test+unsubscribe@mlmmjtest
+Return-Path: jane@test
+EOF
+ atf_check $mlmmjreceive -L list -F <unsubscribe
+ cat > expected-4.txt <<EOF
+EHLO heloname\r
+MAIL FROM:<test+bounces-confunsub-@mlmmjtest>\r
+RCPT TO:<bob@test>\r
+DATA\r
+Subject: =?utf-8?q?Confirm_unsubscribe_from_test=40mlmmjtest?=\r
+From: test+help@mlmmjtest\r
+To: bob@test\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: 8bit\r
+Reply-To: test+confunsub-@mlmmjtest\r
+\r
+Hi, this is the Mlmmj program managing the <test@mlmmjtest> mailing list.\r
+\r
+Somebody (and we hope it was you) has requested that the email address\r
+<bob@test> be removed from the list.\r
+\r
+To confirm you want to do this, please send a message to\r
+<test+confunsub-@mlmmjtest> which can usually be done\r
+simply by replying to this message. The subject and the body of the message\r
+can be anything.\r
+\r
+After doing so, you should receive a reply informing you that the operation\r
+succeeded.\r
+\r
+If you do not want to do this, simply ignore this message.\r
+\r
+\r
+.\r
+QUIT\r
+EOF
+ atf_check -o file:expected-4.txt sed -e "/^Message-ID:/d; /^Date:/d; s/confunsub-.*@mlmmjtest/confunsub-@mlmmjtest/g" mail-4.txt
+ var=$(ls list/unsubconf)
+ cat > confirm-unsub << EOF
+From: bob@test
+To: test+confunsub-${var##*/}@mlmmjtest
+Return-Path: jane@test
+EOF
+ atf_check $mlmmjreceive -L list -F <confirm-unsub
+ cat > expected-5.txt <<EOF
+EHLO heloname\r
+MAIL FROM:<test+bounces-help@mlmmjtest>\r
+RCPT TO:<bob@test>\r
+DATA\r
+Subject: =?utf-8?q?Goodbye_from_test=40mlmmjtest?=\r
+From: test+help@mlmmjtest\r
+To: bob@test\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: 8bit\r
+\r
+Hi, this is the Mlmmj program managing the <test@mlmmjtest> mailing list.\r
+\r
+Thank you for confirming your unsubscribe. You have now been removed from\r
+the list.\r
+\r
+\r
+.\r
+QUIT\r
+EOF
+ atf_check -o file:expected-5.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-5.txt
+ atf_check -s exit:1 test -f list/subscribers.d/b
+}
+
+subscribe_nomail_body()
+{
+ atf_check $srcdir/fakesmtpd
+ trap kill_fakesmtp EXIT TERM
+ init_ml list
+ rmdir list/text
+ ln -s ${srcdir}/../listtexts/en list/text
+ echo test@mlmmjtest > list/control/listaddress
+ echo "25678" > list/control/smtpport
+ echo "heloname" > list/control/smtphelo
+
+ cat > subscribe << EOF
+From: bob@test
+To: test+subscribe-nomail@mlmmjtest
+Return-Path: jane@test
+Subject: subscribe
+
+this is a subscribtion test
+EOF
+ atf_check $mlmmjreceive -L list -F <subscribe
+
+cat > expected-1.txt <<EOF
+EHLO heloname\r
+MAIL FROM:<test+bounces-confsub-@mlmmjtest>\r
+RCPT TO:<bob@test>\r
+DATA\r
+Subject: =?utf-8?q?Confirm_subscription_to_test=40mlmmjtest?=\r
+From: test+help@mlmmjtest\r
+To: bob@test\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: 8bit\r
+Reply-To: test+confsub-nomail@mlmmjtest\r
+\r
+Hi, this is the Mlmmj program managing the <test@mlmmjtest> mailing list.\r
+\r
+Somebody (and we hope it was you) has requested that your email address\r
+<bob@test> be added to the list, without mail delivery. This means you will\r
+not receive any posts to the list, but you are considered a member. This\r
+means, for instance, you are able to post to a list which only subscribers\r
+may post to, while you follow the list using a web archive or another\r
+subscribed email address.\r
+\r
+To confirm you want to do this, please send a message to\r
+<test+confsub-nomail@mlmmjtest> which can usually be done\r
+simply by replying to this message. The subject and the body of the message\r
+can be anything.\r
+\r
+After doing so, you should receive a reply informing you that the operation\r
+succeeded.\r
+\r
+If you do not want to do this, simply ignore this message.\r
+\r
+\r
+.\r
+QUIT\r
+EOF
+ atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d; s/confsub-nomail.*@mlmmjtest/confsub-nomail@mlmmjtest/g; s/bounces-confsub-.*@mlmmjtest/bounces-confsub-@mlmmjtest/g" mail-1.txt
+ var=$(ls list/subconf)
+
+ cat > confirm << EOF
+From: bob@test
+To: test+confsub-nomail-${var##*/}@mlmmjtest
+Return-Path: jane@test
+Subject: subscribe
+
+this is a subscribtion test
+EOF
+ atf_check $mlmmjreceive -L list -F <confirm
+ cat > expected-2.txt <<EOF
+EHLO heloname\r
+MAIL FROM:<test+bounces-help@mlmmjtest>\r
+RCPT TO:<bob@test>\r
+DATA\r
+Subject: =?utf-8?q?Welcome_to_test=40mlmmjtest?=\r
+From: test+help@mlmmjtest\r
+To: bob@test\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: 8bit\r
+\r
+Hi, this is the Mlmmj program managing the <test@mlmmjtest> mailing list.\r
+\r
+Thank you for confirming your subscription. You have now been added to the\r
+no-mail version of the list.\r
+\r
+The email address you are subscribed with is <bob@test>.\r
+\r
+If you ever wish to unsubscribe, send a message to\r
+<test+unsubscribe@mlmmjtest> using this email address. The subject and the\r
+body of the message can be anything. You will then receive confirmation or\r
+further instructions.\r
+\r
+For other information and help about this list, send a message to\r
+<test+help@mlmmjtest>.\r
+\r
+\r
+.\r
+QUIT\r
+EOF
+ atf_check -o file:expected-2.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-2.txt
+ atf_check -o inline:"bob@test\n" cat list/nomailsubs.d/b
+ atf_check -s exit:1 test -f list/subconf/${var}
+
+# second confirmation
+ atf_check $mlmmjreceive -L list -F <confirm
+ atf_check -s exit:1 test -f mail-3.txt
+ cat > expected-3.txt << EOF
+EHLO heloname\r
+MAIL FROM:<test+bounces-help@mlmmjtest>\r
+RCPT TO:<bob@test>\r
+DATA\r
+Subject: =?utf-8?q?Unable_to_subscribe_to_test=40mlmmjtest?=\r
+From: test+help@mlmmjtest\r
+To: bob@test\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: 8bit\r
+\r
+Hi, this is the Mlmmj program managing the <test@mlmmjtest> mailing list.\r
+\r
+You were unable to be subscribed to the list because you are already\r
+subscribed.\r
+\r
+\r
+.\r
+QUIT\r
+EOF
+ # New subscribtion
+ atf_check $mlmmjreceive -L list -F <subscribe
+ atf_check -o file:expected-3.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-3.txt
+
+ cat > unsubscribe <<EOF
+From: bob@test
+To: test+unsubscribe@mlmmjtest
+Return-Path: jane@test
+EOF
+ atf_check $mlmmjreceive -L list -F <unsubscribe
+ cat > expected-4.txt <<EOF
+EHLO heloname\r
+MAIL FROM:<test+bounces-confunsub-@mlmmjtest>\r
+RCPT TO:<bob@test>\r
+DATA\r
+Subject: =?utf-8?q?Confirm_unsubscribe_from_test=40mlmmjtest?=\r
+From: test+help@mlmmjtest\r
+To: bob@test\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: 8bit\r
+Reply-To: test+confunsub-@mlmmjtest\r
+\r
+Hi, this is the Mlmmj program managing the <test@mlmmjtest> mailing list.\r
+\r
+Somebody (and we hope it was you) has requested that the email address\r
+<bob@test> be removed from the list.\r
+\r
+To confirm you want to do this, please send a message to\r
+<test+confunsub-@mlmmjtest> which can usually be done\r
+simply by replying to this message. The subject and the body of the message\r
+can be anything.\r
+\r
+After doing so, you should receive a reply informing you that the operation\r
+succeeded.\r
+\r
+If you do not want to do this, simply ignore this message.\r
+\r
+\r
+.\r
+QUIT\r
+EOF
+ atf_check -o file:expected-4.txt sed -e "/^Message-ID:/d; /^Date:/d; s/confunsub-.*@mlmmjtest/confunsub-@mlmmjtest/g" mail-4.txt
+ var=$(ls list/unsubconf)
+ cat > confirm-unsub << EOF
+From: bob@test
+To: test+confunsub-${var##*/}@mlmmjtest
+Return-Path: jane@test
+EOF
+ atf_check $mlmmjreceive -L list -F <confirm-unsub
+ cat > expected-5.txt <<EOF
+EHLO heloname\r
+MAIL FROM:<test+bounces-help@mlmmjtest>\r
+RCPT TO:<bob@test>\r
+DATA\r
+Subject: =?utf-8?q?Goodbye_from_test=40mlmmjtest?=\r
+From: test+help@mlmmjtest\r
+To: bob@test\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: 8bit\r
+\r
+Hi, this is the Mlmmj program managing the <test@mlmmjtest> mailing list.\r
+\r
+Thank you for confirming your unsubscribe. You have now been removed from\r
+the list.\r
+\r
+\r
.\r
QUIT\r
EOF