Mail Muxer
Are you tired of managing IMAP filters through cumbersome, slow and unintuive web interfaces ? Then Mail Muxer is here to save you from this pain !
Mail Muxer is a Python tool that will monitor your Inbox, and filter incomming emails according to the given configuration. It was designed to be intuitive and easy to use, by using compact configuration and sensible defaults: a rule can be as simple as
- condition:
FROM: example@email.org
move_to: some/folder
Basic Usage
-
Install:
pip install mmuxer -
Create configuration file:
rules: - move_to: receipts condition: ANY: - FROM: some_store@ok.ok - FROM: some_other_store@store.net - move_to: important condition: SUBJECT: important - condition: FROM: spammer@example.com actions: - delete settings: server: imap.email.net username: me@email.net password: secret
-
Check your configuration:
mmuxer check --config-file config.yaml -
Check your folders:
mmuxer folder --config-file config.yaml compare-destinations -
Monitor your inbox:
mmuxer monitor --config-file config.yaml -
Or apply on all messages of a given IMAP folder:
mmuxer tidy --config-file config.yaml --folder FOLDER -
Finally, to get help on a given command, add a
--helpto it, e.g.mmuxer monitor --help
Sieve interraction
MMuxer allows you to interract with sieves with the mmuxer sieve commands:
list: List sieve scripts on the server.put: Upload a sieve script generated from rules to the server.export: Convert the rules of the give config file to sieve format.
Note that server support of managesieve commands is necessary for list and put commands to work.
Settings
Using env variables for settings
Settings values (username, password, etc.) can be configured by providing environment variables of the same name (case insensitive).
Exporting configuration to sieve format
mmuxer can also export the rules of a configuration file to the sieve format, so that the rules will be handled server side.
mmuxer sieve-export --config-file config.yaml --dest-file rules.sieve
Note on SSL
If you get SSL errors while connecting to your server, see the SSL Configuration section.
All available settings
server: str
username: str
password: str
ssl_ciphers: Optional[str] = None
imap_wait_timeout: int = 60
sieve:
folder_prefix: str = "" # folder prefix used when generating sieve rules
folder_separator: str = "." # folder separator used when generating sieve rules
name: str | None = None # name used when exporting with managesieve
extensions: list[str] = ["fileinto"]
Going further on
- Advanced usage
- Use with docker/systemd: see doc
What's next
The current implementation is mostly feature complete for me, but here are some features that could be implemented:
- Improve
tidyoperation:- make
tidyoperation more performant by using IMAP search features - allow to run
tidyon many / all folders
- make
- Better conditions:
- add a
REGEXoperator (although not compatible with IMAP search) - support more fields
- add a
- Add more actions:
- tag emails
- forward emails
- move destination based on regex match group
- automatic folder creation
- anything else ?
- Hot-reload config file
- Re-configure (or execute actions) by sending emails
- Support OAuth / Gmail (I'm not sure how feasible that would be).
Don't hesitate to ask, or make a pull request !
Credit
This program relies on
- the imap-tools library for everything involving IMAP
- the mock IMAP server from aioimaplib for it's tests
- the ever excellent Typer and Pydantic libs
Many thanks to them !
Metadata
Release files for mmuxer 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mmuxer-0.7.0.tar.gz | 41.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mmuxer-0.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 76.1 kB
Release files / mmuxer-0.7.0.tar.gz
| Download URL | mmuxer-0.7.0.tar.gz |
|---|---|
| Size | 41.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c62878b55ab7db4c09d4e2c6e78523457d38496bebf4fd369a0f815ae61e1f3
|
|
BLAKE2b-256 checksum How to use checksums |
7ce588c5745a7718b798c4c0717572cd5a1ae00cbab926439b160ead5fce3975
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / mmuxer-0.7.0-py3-none-any.whl
| Download URL | mmuxer-0.7.0-py3-none-any.whl |
|---|---|
| Size | 34.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f7c52afe4921de897d57d84b19ca5fb7e365c04653b31f317b8e50e91520dbe1
|
|
BLAKE2b-256 checksum How to use checksums |
310a2865758561b1795bb2e2b34822641d2643e8ebdef74d1bfe21ae455415ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|