https://github.com/k8scat/formair
auto Forward eMails with custom Rules 自定义规则的邮件自动转发工具
https://github.com/k8scat/formair
email email-forwarding imap pop3 python smtp
Last synced: about 1 month ago
JSON representation
auto Forward eMails with custom Rules 自定义规则的邮件自动转发工具
- Host: GitHub
- URL: https://github.com/k8scat/formair
- Owner: k8scat
- License: mit
- Created: 2021-02-07T04:18:27.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-02T14:25:08.000Z (almost 3 years ago)
- Last Synced: 2025-08-30T01:44:00.955Z (about 1 month ago)
- Topics: email, email-forwarding, imap, pop3, python, smtp
- Language: Python
- Homepage: https://k8scat.github.io/ForMaiR/
- Size: 52.7 KB
- Stars: 17
- Watchers: 1
- Forks: 9
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [ForMaiR](https://formair.io) - auto Forward eMails with custom Rules
## Quick start using Docker
Refer config: [template/config.yaml](https://github.com/k8scat/ForMaiR/blob/master/template/config.yaml)
```bash
docker run -d --rm \
-v /path/to/config.yaml:/formair/conf/config.yaml \
k8scat/formair:latest
```## Installation
### Install using `pip`
```bash
python3 -m pip install --user formair
```### Install using `git`
```bash
git clone git@github.com:k8scat/ForMaiR.git
cd ForMaiR
python3 setup.py install
```## Usage
Refer config: [template/config.yaml](https://github.com/k8scat/ForMaiR/blob/master/template/config.yaml)
```bash
formair # load config from ./config.yamlformair /path/to/config.yaml # load config from /path/to/config.yaml
```## Custom rules
Emails which meet follow rules will be auto forwarded to `to_addrs`.
- [x] Email `from_addr[1]` in `from_addrs`
- [x] Email `subject` meet `subject_pattern`
- [x] Email `plain_content` or `html_content` meet `content_pattern````yaml
rules:
-
to_addrs:
- 't1@example.com'
- 't2@example.com'
from_addrs:
- 'f1@example.com'
- 'f2@example.com'
subject_pattern: ''
content_pattern: ''
-
to_addrs:
- 't1@example.com'
- 't2@example.com'
from_addrs:
- 'f1@example.com'
- 'f2@example.com'
subject_pattern: ''
content_pattern: ''
```## Only forwarding the new emails
Support forwarding new emails in the specified range.
- Get `last_email_index` from the _index_file_ (default 0 if not exists)
- Get `email_count` from `pop3_server.stat````python
for index in range(last_email_index+1, email_count+1):
pass
```## Docs
[https://formair.io](https://formair.io)