4
The 'implicit-dest' rule matches when the mailing list's posting address is
5
not explicitly mentioned in the set of message recipients.
7
>>> from Mailman.configuration import config
8
>>> mlist = config.db.list_manager.create(u'_xtest@example.com')
9
>>> rule = config.rules['implicit-dest']
13
This rule matches messages that have implicit destination, meaning that the
14
mailing list's posting address isn't included in the explicit recipients.
16
>>> mlist.require_explicit_destination = True
17
>>> mlist.acceptable_aliases = u''
18
>>> msg = message_from_string(u"""\
19
... From: aperson@example.org
20
... Subject: An implicit message
23
>>> rule.check(mlist, msg, {})
26
You can disable implicit destination checks for the mailing list.
28
>>> mlist.require_explicit_destination = False
29
>>> rule.check(mlist, msg, {})
32
Even with some recipients, if the posting address is not included, the rule
35
>>> mlist.require_explicit_destination = True
36
>>> msg['To'] = 'myfriend@example.com'
37
>>> rule.check(mlist, msg, {})
40
Add the posting address as a recipient and the rule will no longer match.
42
>>> msg['Cc'] = '_xtest@example.com'
43
>>> rule.check(mlist, msg, {})
46
Alternatively, if one of the acceptable aliases is in the recipients list,
47
then the rule will not match.
50
>>> rule.check(mlist, msg, {})
52
>>> mlist.acceptable_aliases = u'myfriend@example.com'
53
>>> rule.check(mlist, msg, {})
56
A message gated from NNTP will obviously have an implicit destination. Such
57
gated messages will not be held for implicit destination because it's assumed
58
that Mailman pulled it from the appropriate news group.
60
>>> rule.check(mlist, msg, dict(fromusenet=True))
67
It's also possible to specify an alias pattern, i.e. a regular expression to
68
match against the recipients. For example, we can say that if there is a
69
recipient in the example.net domain, then the rule does not match.
71
>>> mlist.acceptable_aliases = u'^.*@example.net'
72
>>> rule.check(mlist, msg, {})
74
>>> msg['To'] = 'you@example.net'
75
>>> rule.check(mlist, msg, {})