summaryrefslogtreecommitdiff
path: root/src/mailman/handlers/docs/owner-recips.rst
blob: ff9467b13c806201f369c9e69ccd4cd2bcc758fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
=====================
List owner recipients
=====================

When a message is posted to a mailing list's `-owners` address, all of the
list's administrators will receive a copy.  The administrators are defined as
the set of owners and moderators.

    >>> mlist_1 = create_list('alpha@example.com')

Anne is the owner of the list and Bart is a moderator of the list.

    >>> from mailman.interfaces.usermanager import IUserManager
    >>> from zope.component import getUtility
    >>> user_manager = getUtility(IUserManager)
    >>> anne_addr = user_manager.create_address('anne@example.com')
    >>> bart_addr = user_manager.create_address('bart@example.com')
    >>> from mailman.interfaces.member import MemberRole
    >>> anne = mlist_1.subscribe(anne_addr, MemberRole.owner)
    >>> bart = mlist_1.subscribe(bart_addr, MemberRole.moderator)

The recipients list for the `-owners` address includes both Anne and Bart.

    >>> msg = message_from_string("""\
    ... From: Xavier Person <xperson@example.com>
    ... To: alpha@example.com
    ...
    ... """)
    >>> msgdata = {}
    >>> handler = config.handlers['owner-recipients']
    >>> handler.process(mlist_1, msg, msgdata)
    >>> dump_list(msgdata['recipients'])
    anne@example.com
    bart@example.com

Anne disables her owner delivery, so she will not receive `-owner` emails.

    >>> from mailman.interfaces.member import DeliveryStatus
    >>> anne.preferences.delivery_status = DeliveryStatus.by_user
    >>> msgdata = {}
    >>> handler.process(mlist_1, msg, msgdata)
    >>> dump_list(msgdata['recipients'])
    bart@example.com

If Bart also disables his owner delivery, then no one could contact the list's
owners.  Since this is unacceptable, the site owner is used as a fallback.

    >>> bart.preferences.delivery_status = DeliveryStatus.by_user
    >>> msgdata = {}
    >>> handler.process(mlist_1, msg, msgdata)
    >>> dump_list(msgdata['recipients'])
    noreply@example.com

For mailing lists which have no owners at all, the site owner is also used as
a fallback.

    >>> mlist_2 = create_list('beta@example.com')
    >>> print(mlist_2.administrators.member_count)
    0
    >>> msgdata = {}
    >>> handler.process(mlist_2, msg, msgdata)
    >>> dump_list(msgdata['recipients'])
    noreply@example.com