blob: 5166100e225313ad733e9d21c47fdb710b0844cf (
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
|
=================
No Subject header
=================
This rule matches if the message has no ``Subject:`` header, or if the header
is the empty string when stripped.
>>> mlist = create_list('_xtest@example.com')
>>> rule = config.rules['no-subject']
>>> print(rule.name)
no-subject
A message with a non-empty subject does not match the rule.
>>> msg = message_from_string("""\
... From: aperson@example.org
... To: _xtest@example.com
... Subject: A posted message
...
... """)
>>> rule.check(mlist, msg, {})
False
Delete the ``Subject:`` header and the rule matches.
>>> del msg['subject']
>>> rule.check(mlist, msg, {})
True
Even a ``Subject:`` header with only whitespace still matches the rule.
>>> msg['Subject'] = ' '
>>> rule.check(mlist, msg, {})
True
|