summaryrefslogtreecommitdiff
path: root/src/mailman/pipeline/docs/reply-to.txt
blob: e08fea81d1336a4b6f36f35c5d2ac39d677cba5e (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
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
================
Reply-to munging
================

Messages that flow through the global pipeline get their headers *cooked*,
which basically means that their headers go through several mostly unrelated
transformations.  Some headers get added, others get changed.  Some of these
changes depend on mailing list settings and others depend on how the message
is getting sent through the system.  We'll take things one-by-one.

    >>> mlist = create_list('_xtest@example.com')

*Reply-to munging* refers to the behavior where a mailing list can be
configured to change or augment an existing ``Reply-To`` header in a message
posted to the list.  Reply-to munging is fairly controversial, with arguments
made either for or against munging.

The Mailman developers, and I believe the majority consensus is to do no
reply-to munging, under several principles.  Primarily, most reply-to munging
is requested by people who do not have both a `Reply` and `Reply All` button
on their mail reader.  If you do not munge ``Reply-To``, then these buttons
will work properly, but if you munge the header, it is impossible for these
buttons to work right, because both will reply to the list.  This leads to
unfortunate accidents where a private message is accidentally posted to the
entire list.

However, Mailman gives list owners the option to do reply-To munging anyway,
mostly as a way to shut up the really vocal minority who seem to insist on
this mis-feature.


Reply to list
=============

A list can be configured to add a ``Reply-To`` header pointing back to the
mailing list's posting address.  If there's no ``Reply-To`` header in the
original message, the list's posting address simply gets inserted.
::

    >>> from mailman.interfaces.mailinglist import ReplyToMunging
    >>> mlist.reply_goes_to_list = ReplyToMunging.point_to_list
    >>> mlist.preferred_language = 'en'
    >>> mlist.description = ''
    >>> msg = message_from_string("""\
    ... From: aperson@example.com
    ...
    ... """)

    >>> from mailman.pipeline.cook_headers import process
    >>> process(mlist, msg, {})
    >>> len(msg.get_all('reply-to'))
    1
    >>> print msg['reply-to']
    _xtest@example.com

It's also possible to strip any existing ``Reply-To`` header first, before
adding the list's posting address.

    >>> mlist.first_strip_reply_to = True
    >>> msg = message_from_string("""\
    ... From: aperson@example.com
    ... Reply-To: bperson@example.com
    ...
    ... """)
    >>> process(mlist, msg, {})
    >>> len(msg.get_all('reply-to'))
    1
    >>> print msg['reply-to']
    _xtest@example.com

If you don't first strip the header, then the list's posting address will just
get appended to whatever the original version was.

    >>> mlist.first_strip_reply_to = False
    >>> msg = message_from_string("""\
    ... From: aperson@example.com
    ... Reply-To: bperson@example.com
    ...
    ... """)
    >>> process(mlist, msg, {})
    >>> len(msg.get_all('reply-to'))
    1
    >>> print msg['reply-to']
    bperson@example.com, _xtest@example.com


Explicit Reply-To
=================

The list can also be configured to have an explicit ``Reply-To`` header.

    >>> mlist.reply_goes_to_list = ReplyToMunging.explicit_header
    >>> mlist.reply_to_address = 'my-list@example.com'
    >>> msg = message_from_string("""\
    ... From: aperson@example.com
    ...
    ... """)
    >>> process(mlist, msg, {})
    >>> len(msg.get_all('reply-to'))
    1
    >>> print msg['reply-to']
    my-list@example.com

And as before, it's possible to either strip any existing ``Reply-To``
header...

    >>> mlist.first_strip_reply_to = True
    >>> msg = message_from_string("""\
    ... From: aperson@example.com
    ... Reply-To: bperson@example.com
    ...
    ... """)
    >>> process(mlist, msg, {})
    >>> len(msg.get_all('reply-to'))
    1
    >>> print msg['reply-to']
    my-list@example.com

...or not.

    >>> mlist.first_strip_reply_to = False
    >>> msg = message_from_string("""\
    ... From: aperson@example.com
    ... Reply-To: bperson@example.com
    ...
    ... """)
    >>> process(mlist, msg, {})
    >>> len(msg.get_all('reply-to'))
    1
    >>> print msg['reply-to']
    my-list@example.com, bperson@example.com