5 Every message that makes it through to the list membership gets sent to a set
6 of recipient addresses. These addresses are calculated by one of the handler
7 modules and depends on a host of factors.
9 >>> from mailman.app.lifecycle import create_list
10 >>> mlist = create_list('_xtest@example.com')
12 Recipients are calculate from the list members, so add a bunch of members to
13 start out with. First, create a bunch of addresses...
15 >>> from mailman.interfaces.usermanager import IUserManager
16 >>> from zope.component import getUtility
17 >>> user_manager = getUtility(IUserManager)
19 >>> address_a = user_manager.create_address('aperson@example.com')
20 >>> address_b = user_manager.create_address('bperson@example.com')
21 >>> address_c = user_manager.create_address('cperson@example.com')
22 >>> address_d = user_manager.create_address('dperson@example.com')
23 >>> address_e = user_manager.create_address('eperson@example.com')
24 >>> address_f = user_manager.create_address('fperson@example.com')
26 ...then subscribe these addresses to the mailing list as members...
28 >>> from mailman.interfaces.member import MemberRole
29 >>> member_a = address_a.subscribe(mlist, MemberRole.member)
30 >>> member_b = address_b.subscribe(mlist, MemberRole.member)
31 >>> member_c = address_c.subscribe(mlist, MemberRole.member)
32 >>> member_d = address_d.subscribe(mlist, MemberRole.member)
33 >>> member_e = address_e.subscribe(mlist, MemberRole.member)
34 >>> member_f = address_f.subscribe(mlist, MemberRole.member)
36 ...then make some of the members digest members.
38 >>> from mailman.core.constants import DeliveryMode
39 >>> member_d.preferences.delivery_mode = DeliveryMode.plaintext_digests
40 >>> member_e.preferences.delivery_mode = DeliveryMode.mime_digests
41 >>> member_f.preferences.delivery_mode = DeliveryMode.summary_digests
47 Sometimes, the list of recipients already exists in the message metadata.
48 This can happen for example, when a message was previously delivered to some
49 but not all of the recipients.
51 >>> msg = message_from_string("""\
52 ... From: Xavier Person <xperson@example.com>
54 ... Something of great import.
56 >>> recipients = set(('qperson@example.com', 'zperson@example.com'))
57 >>> msgdata = dict(recipients=recipients)
59 >>> handler = config.handlers['calculate-recipients']
60 >>> handler.process(mlist, msg, msgdata)
61 >>> sorted(msgdata['recipients'])
62 [u'qperson@example.com', u'zperson@example.com']
65 Regular delivery recipients
66 ===========================
68 Regular delivery recipients are those people who get messages from the list as
69 soon as they are posted. In other words, these folks are not digest members.
72 >>> handler.process(mlist, msg, msgdata)
73 >>> sorted(msgdata['recipients'])
74 [u'aperson@example.com', u'bperson@example.com', u'cperson@example.com']
76 Members can elect not to receive a list copy of their own postings.
78 >>> member_c.preferences.receive_own_postings = False
79 >>> msg = message_from_string("""\
80 ... From: Claire Person <cperson@example.com>
82 ... Something of great import.
85 >>> handler.process(mlist, msg, msgdata)
86 >>> sorted(msgdata['recipients'])
87 [u'aperson@example.com', u'bperson@example.com']
89 Members can also elect not to receive a list copy of any message on which they
90 are explicitly named as a recipient. However, see the AvoidDuplicates handler
97 XXX Test various digest deliveries.
103 XXX Test various urgent deliveries:
104 * test_urgent_moderator()
105 * test_urgent_admin()
106 * test_urgent_reject()