Skip to main content

Sifter3 - Sieve email filter (RFC 5228)

Sifter3 is a Python 3 implementation of the Sieve email filter language (RFC 5228)

Python package Documentation Status CodeFactor Github version PyPI version Supported Python versions PyPI downloads GitHub

FEATURES

  • Supports all of the base Sieve spec from RFC 5228, except for features still listed under TODO below
    • multiline strings (since version 0.2.2)
    • bracketed comments (since version 0.2.4)
  • Extensions supported:
    • regex (draft-ietf-sieve-regex-01)
    • body (RFC 5173)
    • variables (RFC 5229)
    • enotify (RFC 5435, particularly the mailto method RFC 5436)
    • imap4flags (RFC 5232: setflag, addflag, removeflag; not supported: hasflags, :flags)
    • reject and ereject (RFC 5429)
    • ihave (RFC 5463)

INSTALL

pip install sifter3

EXAMPLE

import email
import sifter.parser
rules = sifter.parser.parse_file(open('my_rules.sieve'))
msg = email.message_from_file(open('an_email_to_me.eml'))
msg_actions = rules.evaluate(msg)

In the above example, msg_actions is a list of actions to apply to the email message. Each action is a tuple consisting of the action name and action-specific arguments. It is up to the caller to manipulate the message and message store based on the actions returned.

COMMAND LINE

The output of the command line tool can be parsed as json.

$ sifter tests/evaluation_1.rules tests/evaluation_1.msg
[['redirect', 'acm@example.com']]

WARNINGS

  • No thought has been given yet to hardening against malicious user input. The current implementation is aimed at users that are running their own sieve scripts.
  • The current implementation is not optimized for performance, though hopefully it's not too slow for normal inputs.

TODO

  • An example adaptor that provides Unix LDA behavior using sieve for filtering
  • Base spec features not yet implemented:
    • encoded characters (section 2.4.2.4)
    • message uniqueness (section 2.10.3)
    • envelope test (section 5.4)
    • handle message loops (section 10)
    • limit abuse of redirect action (section 10)
    • address test should limit allowed headers to those that contain addresses (section 5.1)
  • Make sure character sets are actually handled according to the spec
  • Make string parsing comply with the grammar in section 8.1 and the features described in section 2.4.2
  • Check that python's email.message implements header comparisons the same way as the sieve spec
  • Make sure regular expressions are actually handled according to the extension spec
  • Add support for various extensions:
    • externally stored lists (draft-melnikov-sieve-external-lists)
    • relational (RFC 5231)
    • subaddress (RFC 5233)
    • copy (RFC 3894)
    • environment (RFC 5183)
    • date and index (RFC 5260)
    • editheader (RFC 5293)
    • mailbox metadata (RFC 5490)
    • xmpp notifications (RFC 5437)

Release files for sifter3 0.2.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sifter3 0.2.7
File Size Uploaded
sifter3-0.2.7.tar.gz 25.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sifter3 0.2.7
File Interpreter ABI Platform
sifter3-0.2.7-py3-none-any.whl Python 3 none any Details

Total release size: 66.1 kB

Release files / sifter3-0.2.7.tar.gz

Download URL sifter3-0.2.7.tar.gz
Size 25.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5eeac1ae6181217938fdef7322f62b0d1f1deefabac41d4567713b242bf12b0e
BLAKE2b-256 checksum
How to use checksums
9e409cc5921832f223a73927752b56447ccf20bed56d285a4cd59d6a1525ad45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.9.0

Release files / sifter3-0.2.7-py3-none-any.whl

Download URL sifter3-0.2.7-py3-none-any.whl
Size 40.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bce717097172b7ff17d472dbeb52507e5e41e20a5496930267ddf2d4607a2eca
BLAKE2b-256 checksum
How to use checksums
398544491194ff0599ba932e1a2aa6c7e5fac58f500dfd200e697a1d24ff46c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.9.0

Release history Release notifications | RSS feed

This release

0.2.7 This release

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page