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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
Message acknowledgment
======================
When a user posts a message to a mailing list, and that user has chosen to
receive acknowledgments of their postings, Mailman will sent them such an
acknowledgment.
>>> from email import message_from_string
>>> from Mailman.Message import Message
>>> from Mailman.Handlers.Acknowledge import process
>>> from Mailman.configuration import config
>>> from Mailman.database import flush
>>> mlist = config.list_manager.create('_xtest@example.com')
>>> mlist.real_name = 'XTest'
>>> mlist.preferred_language = 'en'
>>> # XXX This will almost certainly change once we've worked out the web
>>> # space layout for mailing lists now.
>>> mlist._data.web_page_url = 'http://lists.example.com/'
>>> flush()
>>> # Ensure that the virgin queue is empty, since we'll be checking this
>>> # for new auto-response messages.
>>> from Mailman.Queue.sbcache import get_switchboard
>>> virginq = get_switchboard(config.VIRGINQUEUE_DIR)
>>> virginq.files
[]
Subscribe a user to the mailing list.
>>> from Mailman.constants import MemberRole
>>> user_1 = config.user_manager.create_user('aperson@example.com')
>>> address_1 = list(user_1.addresses)[0]
>>> address_1.subscribe(mlist, MemberRole.member)
<Member: aperson@example.com on _xtest@example.com as MemberRole.member>
>>> flush()
Non-member posts
----------------
Non-members can't get acknowledgments of their posts to the mailing list.
>>> msg = message_from_string("""\
... From: bperson@example.com
...
... """, Message)
>>> process(mlist, msg, {})
>>> virginq.files
[]
We can also specify the original sender in the message's metadata. If that
person is also not a member, no acknowledgment will be sent either.
>>> msg = message_from_string("""\
... From: bperson@example.com
...
... """, Message)
>>> process(mlist, msg, dict(original_sender='cperson@example.com'))
>>> virginq.files
[]
No acknowledgment requested
---------------------------
Unless the user has requested acknowledgments, they will not get one.
>>> msg = message_from_string("""\
... From: aperson@example.com
...
... """, Message)
>>> process(mlist, msg, {})
>>> virginq.files
[]
Similarly if the original sender is specified in the message metadata, and
that sender is a member but not one who has requested acknowledgments, none
will be sent.
>>> user_2 = config.user_manager.create_user('dperson@example.com')
>>> address_2 = list(user_2.addresses)[0]
>>> address_2.subscribe(mlist, MemberRole.member)
<Member: dperson@example.com on _xtest@example.com as MemberRole.member>
>>> flush()
>>> process(mlist, msg, dict(original_sender='dperson@example.com'))
>>> virginq.files
[]
Requested acknowledgments
-------------------------
If the member requests acknowledgments, Mailman will send them one when they
post to the mailing list.
>>> user_1.preferences.acknowledge_posts = True
>>> flush()
The receipt will include the original message's subject in the response body,
>>> msg = message_from_string("""\
... From: aperson@example.com
... Subject: Something witty and insightful
...
... """, Message)
>>> process(mlist, msg, {})
>>> len(virginq.files)
1
>>> qmsg, qdata = virginq.dequeue(virginq.files[0])
>>> virginq.files
[]
>>> # Print only some of the meta data. The rest is uninteresting.
>>> qdata['listname']
'_xtest@example.com'
>>> qdata['recips']
['aperson@example.com']
>>> print qmsg.as_string()
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Subject: XTest post acknowledgment
From: _xtest-bounces@example.com
To: aperson@example.com
Message-ID: ...
Date: ...
Precedence: bulk
<BLANKLINE>
Your message entitled
<BLANKLINE>
Something witty and insightful
<BLANKLINE>
was successfully received by the XTest mailing list.
<BLANKLINE>
List info page: http://lists.example.com/listinfo/_xtest@example.com
Your preferences: http://example.com/aperson@example.com
<BLANKLINE>
If there is no subject, then the receipt will use a generic message.
>>> msg = message_from_string("""\
... From: aperson@example.com
...
... """, Message)
>>> process(mlist, msg, {})
>>> len(virginq.files)
1
>>> qmsg, qdata = virginq.dequeue(virginq.files[0])
>>> virginq.files
[]
>>> # Print only some of the meta data. The rest is uninteresting.
>>> qdata['listname']
'_xtest@example.com'
>>> qdata['recips']
['aperson@example.com']
>>> print qmsg.as_string()
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Subject: XTest post acknowledgment
From: _xtest-bounces@example.com
To: aperson@example.com
Message-ID: ...
Date: ...
Precedence: bulk
<BLANKLINE>
Your message entitled
<BLANKLINE>
(no subject)
<BLANKLINE>
was successfully received by the XTest mailing list.
<BLANKLINE>
List info page: http://lists.example.com/listinfo/_xtest@example.com
Your preferences: http://example.com/aperson@example.com
<BLANKLINE>
|