推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
hsowan
V2EX  ›  Python

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

  •  1
     
  •   hsowan ·
    k8scat · Feb 7, 2021 · 2613 views
    This topic created in 2058 days ago, the information mentioned may be changed or developed.

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

    ForMaiR: auto Forward eMails with custom Rules

    自定义规则

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

    • <input checked="" disabled="" type="checkbox"> 邮件的发件人(from_addr[1])在指定的发件人列表中(from_addrs)
    • <input checked="" disabled="" type="checkbox"> 邮件的主题(subject)匹配指定的主题正则表达式(subject_pattern)
    • <input checked="" disabled="" type="checkbox"> 邮件的内容(plain_content 或 html_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_count 从 index_file 文件中读取 (如果文件不存在,则默认是 0)
    • email_count 从 pop3_server.stat 获取

    开源代码

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

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5130 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 08:08 · PVG 16:08 · LAX 01:08 · JFK 04:08
    ♥ Do have faith in what you're doing.