|
| 1 | +# Sifter3 - Sieve email filter (RFC 5228) |
| 2 | + |
| 3 | +Sifter3 is a Python 3 implementation of the Sieve email filter language (RFC 5228) and is based on the Python 2 version from <https://github.com/garyp/sifter> |
| 4 | + |
| 5 | + |
| 6 | +[](https://sifter3.readthedocs.io/de/master/?badge=master) |
| 7 | +[](https://www.codefactor.io/repository/github/manfred-kaiser/sifter3) |
| 8 | +[](https://github.com/manfred-kaiser/sifter3/releases) |
| 9 | +[](https://pypi.org/project/sifter3/) |
| 10 | +[](https://pypi.org/project/sifter3/) |
| 11 | +[](https://pepy.tech/project/sifter3/month) |
| 12 | +[](LICENSE) |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | +FEATURES |
| 17 | +======== |
| 18 | + |
| 19 | +- Supports all of the base Sieve spec from RFC 5228, except for |
| 20 | + features still listed under TODO below |
| 21 | +- Extensions supported: |
| 22 | + - regex (draft-ietf-sieve-regex-01) |
| 23 | + |
| 24 | +EXAMPLE |
| 25 | +======= |
| 26 | + |
| 27 | + import email |
| 28 | + import sifter.parser |
| 29 | + rules = sifter.parser.parse_file(open('my_rules.sieve')) |
| 30 | + msg = email.message_from_file(open('an_email_to_me.eml')) |
| 31 | + msg_actions = rules.evaluate(msg) |
| 32 | + |
| 33 | +In the above example, `msg_actions` is a list of actions to apply to the |
| 34 | +email message. Each action is a tuple consisting of the action name and |
| 35 | +action-specific arguments. It is up to the caller to manipulate the |
| 36 | +message and message store based on the actions returned. |
| 37 | + |
| 38 | +WARNINGS |
| 39 | +======== |
| 40 | + |
| 41 | +- No thought has been given yet to hardening against malicious user |
| 42 | + input. The current implementation is aimed at users that are running |
| 43 | + their own sieve scripts. |
| 44 | +- The current implementation is not optimized for performance, though |
| 45 | + hopefully it's not too slow for normal inputs. |
| 46 | + |
| 47 | +TODO |
| 48 | +==== |
| 49 | + |
| 50 | +In rough order of importance: |
| 51 | + |
| 52 | +- An example adaptor that provides Unix LDA behavior using sieve for |
| 53 | + filtering |
| 54 | +- Base spec features not yet implemented: |
| 55 | + - encoded characters (section 2.4.2.4) |
| 56 | + - multi-line strings (section 2.4.2) |
| 57 | + - bracketed comments (section 2.3) |
| 58 | + - message uniqueness (section 2.10.3) |
| 59 | + - envelope test (section 5.4) |
| 60 | + - handle message loops (section 10) |
| 61 | + - limit abuse of redirect action (section 10) |
| 62 | + - address test should limit allowed headers to those that contain |
| 63 | + addresses (section 5.1) |
| 64 | +- Make sure character sets are actually handled according to the spec |
| 65 | +- Make string parsing comply with the grammar in section 8.1 and the |
| 66 | + features described in section 2.4.2 |
| 67 | +- Check that python's `email.message` implements header comparisons |
| 68 | + the same way as the sieve spec |
| 69 | +- Make sure regular expressions are actually handled according to the |
| 70 | + extension spec |
| 71 | +- Add support for various extensions: |
| 72 | + - variables (RFC 5229) |
| 73 | + - externally stored lists (draft-melnikov-sieve-external-lists) |
| 74 | + - body (RFC 5173) |
| 75 | + - relational (RFC 5231) |
| 76 | + - subaddress (RFC 5233) |
| 77 | + - copy (RFC 3894) |
| 78 | + - environment (RFC 5183) |
| 79 | + - date and index (RFC 5260) |
| 80 | + - editheader (RFC 5293) |
| 81 | + - ihave (RFC 5463) |
| 82 | + - mailbox metadata (RFC 5490) |
| 83 | + - notifications (RFC 5435), mailto notifications (RFC 5436), xmpp |
| 84 | + notifications (RFC 5437) |
0 commit comments