summaryrefslogtreecommitdiff
path: root/src/mailman/rules/docs/recipients.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/rules/docs/recipients.txt')
-rw-r--r--src/mailman/rules/docs/recipients.txt40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/mailman/rules/docs/recipients.txt b/src/mailman/rules/docs/recipients.txt
new file mode 100644
index 000000000..3cd49d501
--- /dev/null
+++ b/src/mailman/rules/docs/recipients.txt
@@ -0,0 +1,40 @@
+Maximum number of recipients
+============================
+
+The 'max-recipients' rule matches when there are more than the maximum allowed
+number of explicit recipients addressed by the message.
+
+ >>> mlist = config.db.list_manager.create(u'_xtest@example.com')
+ >>> rule = config.rules['max-recipients']
+ >>> print rule.name
+ max-recipients
+
+In this case, we'll create a message with 5 recipients. These include all
+addresses in the To and CC headers.
+
+ >>> msg = message_from_string("""\
+ ... From: aperson@example.com
+ ... To: _xtest@example.com, bperson@example.com
+ ... Cc: cperson@example.com
+ ... Cc: dperson@example.com (Dan Person)
+ ... To: Elly Q. Person <eperson@example.com>
+ ...
+ ... Hey folks!
+ ... """)
+
+For backward compatibility, the message must have fewer than the maximum
+number of explicit recipients.
+
+ >>> mlist.max_num_recipients = 5
+ >>> rule.check(mlist, msg, {})
+ True
+
+ >>> mlist.max_num_recipients = 6
+ >>> rule.check(mlist, msg, {})
+ False
+
+Zero means any number of recipients are allowed.
+
+ >>> mlist.max_num_recipients = 0
+ >>> rule.check(mlist, msg, {})
+ False