summaryrefslogtreecommitdiff
path: root/wiki/mailman.md
blob: c9b5c2be00efdb30ec706be537161c36e7455142 (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
# Mailman notes

We're running Mailman 3 from Debian package version 3.3.3-1 (as of 2022-08-05).


## Implicit destination

Some emails end up in moderation when sending to a list with the
default setting of not allowing postings without the list address
explicitly set in To: or CC: ("Require Explicit Destination"). Here's
an example of a destination header which triggers this:

    To: "12 45678901234567890123456789012345678901 3456789012345678901234 678901234" <testing@lists.sigsum.org>

The following examples do _not_ trigger moderation:

    To: "spaces and parentheses (do they matter?) and whatnot      " <testing@lists.sigsum.org>
	To: 1234567890123456789012345678901234567890123456789012345678901234567890123456 <testing@lists.sigsum.org>
	To: "12345678901234567890123456789012345678901234567890123456789012345678901234" <testing@lists.sigsum.org>

Let's call the two parts "fullname" and "address". Moderation is
triggered when the fullname part is both long enough (76 characters is
enough while 60 is not) and contains space(s) (3 are enough).

This is handled in `mailman/src/mailman/rules/implicit_dest.py`:

```
        for header in ('to', 'cc', 'resent-to', 'resent-cc'):
            for fullname, address in getaddresses(msg.get_all(header, [])):
                if isinstance(address, bytes):
                    address = address.decode('ascii')
                address = address.lower()
                if address in aliases:
                    return False
                recipients.add(address)
```

At least it doesn't seem like it's getaddresses() which gets it wrong.
```
linus@madvise:~$ python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import email.utils
>>> s='To: "12 45678901234567890123456789012345678901 3456789012345678901234 678901234" <testing@lists.sigsum.org>'
>>> email.utils.getaddresses([s])
[('12 45678901234567890123456789012345678901 3456789012345678901234 678901234', 'testing@lists.sigsum.org')]
```