Skip to content

Commit

Permalink
✨ First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
k8scat committed Feb 7, 2021
0 parents commit c81913a
Show file tree
Hide file tree
Showing 6 changed files with 428 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Release

on:
push:
tags:
- 'v*'

jobs:

release:
name: Release
runs-on: ubuntu-latest
steps:

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: Cafe ${{ steps.get_version.outputs.VERSION }}
draft: false
prerelease: false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 K8sCat <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Cafe

<p align="center">
<a href="https://github.com/k8scat/Cafe">GitHub</a> |
<a href="https://gitee.com/hsowan/Cafe">码云</a>
</p>

Auto forward emails with custom rules.

## 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`

```python
email = {
'from_addr': ('realname', '[email protected]'),
'subject': '',
'plain_content': '',
'html_content': ''
}

transfer_rules = [
{
'to_addrs': [''],
'from_addrs': [''],
'subject_pattern': r'',
'content_pattern': r''
}
]
```

## About `last_email_count`

`Cafe` support forward emails in the specified range.

```python
[last_email_count+1, email_count+1]
```

- `last_email_count` is read from the `index_file` (default 0 if not exists)
- `email_count` is from `pop3_server.stat`
45 changes: 45 additions & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Cafe

<p align="center">
<a href="https://github.com/k8scat/Cafe">GitHub</a> |
<a href="https://gitee.com/hsowan/Cafe">码云</a>
</p>

自定义规则的邮件自动转发工具。

## 自定义规则

满足下列任一规则的邮件会被转发到指定的邮箱列表(`to_addrs`

- [x] 邮件的发件人(`from_addr[1]`)在指定的发件人列表中(`from_addrs`
- [x] 邮件的主题(`subject`)匹配指定的主题正则表达式(`subject_pattern`
- [x] 邮件的内容(`plain_content``html_content`)匹配指定的内容正则表达式(`content_pattern`

```python
email = {
'from_addr': ('realname', '[email protected]'),
'subject': '',
'plain_content': '',
'html_content': ''
}

transfer_rules = [
{
'to_addrs': [''],
'from_addrs': [''],
'subject_pattern': r'',
'content_pattern': r''
}
]
```

## 关于 `last_email_count`

`Cafe` 支持自动转发指定范围内的邮件。

```python
[last_email_count+1, email_count+1]
```

- `last_email_count``index_file` 文件中读取 (如果文件不存在,则默认是 0)
- `email_count``pop3_server.stat` 获取
Loading

0 comments on commit c81913a

Please sign in to comment.