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

由于邮箱自带的转发功能只能转发到指定的邮箱,并不能对邮件内容进行过滤,所以就趁着 leader 过年肥家不在写了这个邮件自动转发工具 ForMaiR

ForMaiR: auto Forward eMails with custom Rules

自定义规则

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

  • [x] 邮件的发件人(from_addr[1])在指定的发件人列表中(from_addrs
  • [x] 邮件的主题(subject)匹配指定的主题正则表达式(subject_pattern
  • [x] 邮件的内容(plain_contenthtml_content)匹配指定的内容正则表达式(content_pattern
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

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

[last_email_count+1, email_count+1]
  • last_email_countindex_file 文件中读取 (如果文件不存在,则默认是 0)
  • email_countpop3_server.stat 获取

开源代码

原文链接:https://k8scat.com/posts/formair/

你可能感兴趣的:(ForMaiR - 自定义规则的邮件自动转发工具)