Cleanup.
[mailman.git] / src / mailman / pipeline / docs / cleanse.txt
blob155de0673718c3c64c1ea7f6473d53c56b267846
1 =================
2 Cleansing headers
3 =================
5 All messages posted to a list get their headers cleansed.  Some headers are
6 related to additional permissions that can be granted to the message and other
7 headers can be used to fish for membership.
9     >>> mlist = create_list('_xtest@example.com')
11 Headers such as Approved, Approve, and Urgent are used to grant special
12 pemissions to individual messages.  All may contain a password; the first two
13 headers are used by list administrators to pre-approve a message normal held
14 for approval.  The latter header is used to send a regular message to all
15 members, regardless of whether they get digests or not.  Because all three
16 headers contain passwords, they must be removed from any posted message.
18     >>> msg = message_from_string("""\
19     ... From: aperson@example.com
20     ... Approved: foobar
21     ... Approve: barfoo
22     ... Urgent: notreally
23     ... Subject: A message of great import
24     ...
25     ... Blah blah blah
26     ... """)
28     >>> handler = config.handlers['cleanse']
29     >>> handler.process(mlist, msg, {})
30     >>> print msg.as_string()
31     From: aperson@example.com
32     Subject: A message of great import
33     <BLANKLINE>
34     Blah blah blah
35     <BLANKLINE>
37 Other headers can be used by list members to fish the list for membership, so
38 we don't let them go through.  These are a mix of standard headers and custom
39 headers supported by some mail readers.  For example, X-PMRC is supported by
40 Pegasus mail.  I don't remember what program uses X-Confirm-Reading-To though
41 (Some Microsoft product perhaps?).
43     >>> msg = message_from_string("""\
44     ... From: bperson@example.com
45     ... Reply-To: bperson@example.org
46     ... Sender: asystem@example.net
47     ... Return-Receipt-To: another@example.com
48     ... Disposition-Notification-To: athird@example.com
49     ... X-Confirm-Reading-To: afourth@example.com
50     ... X-PMRQC: afifth@example.com
51     ... Subject: a message to you
52     ...
53     ... How are you doing?
54     ... """)
55     >>> handler.process(mlist, msg, {})
56     >>> print msg.as_string()
57     From: bperson@example.com
58     Reply-To: bperson@example.org
59     Sender: asystem@example.net
60     Subject: a message to you
61     <BLANKLINE>
62     How are you doing?
63     <BLANKLINE>
66 Anonymous lists
67 ===============
69 Anonymous mailing lists also try to cleanse certain identifying headers from
70 the original posting, so that it is at least a bit more difficult to determine
71 who sent the message.  This isn't perfect though, for example, the body of the
72 messages are never scrubbed (though that might not be a bad idea).  The From
73 and Reply-To headers in the posted message are taken from list attributes.
75 Hotmail apparently sets X-Originating-Email.
77     >>> mlist.anonymous_list = True
78     >>> mlist.description = 'A Test Mailing List'
79     >>> mlist.preferred_language = 'en'
80     >>> msg = message_from_string("""\
81     ... From: bperson@example.com
82     ... Reply-To: bperson@example.org
83     ... Sender: asystem@example.net
84     ... X-Originating-Email: cperson@example.com
85     ... Subject: a message to you
86     ...
87     ... How are you doing?
88     ... """)
89     >>> handler.process(mlist, msg, {})
90     >>> print msg.as_string()
91     Subject: a message to you
92     From: A Test Mailing List <_xtest@example.com>
93     Reply-To: _xtest@example.com
94     <BLANKLINE>
95     How are you doing?
96     <BLANKLINE>