Skip to main content

不知道什么时候跑完程序?发一封邮件吧

Project description

e2me

PyPI download month PyPI version fury.io PyPI pyversions

不知道什么时候跑完程序? 发一封邮件吧

pip install e2me

视频介绍: 【e2me】不知道什么时候跑完程序?发一封邮件吧

快速开始

初次使用需要配置文件, 通过 e2me init 自动生成 e2me.toml, 如下所示

[email]
email = "your-email@example.com"
passwd = "xxx"

cc = [""]

email 改为您的邮箱地址即可,密码为邮箱的 SMTP 密码

如果需要可以填写 cc 抄送对象

获取 SMTP 密码

注意这里的密码并不是邮箱的登录密码, 注意这里的密码并不是邮箱的登录密码, 注意这里的密码并不是邮箱的登录密码, 而是需要开启邮箱的 SMTP/POP3 服务后分配给你的密码

本项目目前支持 163/qq/gmail, 请请参考下述链接开启邮箱的 SMTP/POP3 服务并配置好自己的邮箱和密码

扫描二维码发送短信失败可以手动编辑短信

保存配置

修改完 email 和 passwd 信息之后可以将该信息保存到全局

e2me -s

此选项将使用当前目录的 e2me.toml 覆盖全局配置信息, 此后可以在所有目录下直接使用 e2me run 发送邮件

发送邮件

e2me run

配置信息中 subject 为邮件标题, body 为邮件正文内容, 默认提供了 5 个基本宏用于系统信息的记录, 您可以按照喜好修改对应的文字内容

[content]
subject = "程序运行结束"
body = "[<DATE> | <TIME>] [<KERNEL>] <USER>:<HOSTNAME> "

您希望可以动态调整标题和正文内容, 可以使用 --subject 修改默认邮件标题, --body 修改默认邮件正文内容, 例如

e2me run --subject "llm project A finished" --body "epoch 1"

如果您同时希望将一些结果图片/文件/日志发送, 可以启用 [file] 并填写文件位置, 它们将会被一起发送到邮箱

[file]
file_path = ["result.log"]

您可以编写一个执行脚本, 并在最后一行执行

#!/bin/bash
python main.py
./myprogram

e2me run

Python API

如果您想在程序中发送邮件也非常方便

import e2me
e2me.send_email()
e2me.send_email(subject = "hello", body = "world")

环境变量

在一些特殊情况下可能不想要生成 e2me.toml 配置,您也可以设置环境变量 E2ME_EMAILE2ME_PASSWD 来验证身份

export E2ME_EMAIL=abc@163.com
export E2ME_PASSWD=xxx

接收邮件

$ e2me get
create WANGYI163 email server for [luzhixing12345@163.com]...
获取最近 5 封邮件
[0]: [2026-03-26 21:53] 程序运行结束 [luzhixing12345@163.com]
[1]: [2026-03-26 21:26] 程序运行结束 [luzhixing12345@163.com]
[2]: [2026-03-26 08:00] Paper Notifier: HPCA [2026] 0 Papers [e2me_free@163.com]
[3]: [2026-03-25 19:33] Important Update to GitHub Copilot Interaction Data Usage Policy [no-reply@github.com]
[4]: [2026-03-24 13:17] Overleaf thoughts [welcome@overleaf.com]

Q&A

  • 为什么是自己给自己发送邮件?

    理论上来说只需要注册一个公共邮箱账号负责发送,并硬编码该邮箱的smtp密钥,然后给自己的邮箱发送邮件即可。但是这种方式很容易被各大邮箱和谐,ip登录不统一等等问题,作为一个公共库这种做法会有很大问题

邮箱基本信息

# 协议  服务器         SSL    非 SSL
# SMTP smtp.163.com   465    25
# IMAP imap.163.com   993    143
# POP3 pop.163.com    995    110
# -------------------------------
# SMTP smtp.qq.com    465/587
# IMAP imap.qq.com    993
# POP3 pop.qq.com     995
# -------------------------------
# SMTP smtp.gmail.com 465(SSL)/587(TLS/STARTTLS)
# IMAP imap.gmail.com 993
# POP3 pop.gmail.com  995
# -------------------------------
# 163/qq: password 为授权码
# gmail: password 为 Google 授权密码

参考

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

e2me-0.1.2.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

e2me-0.1.2-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file e2me-0.1.2.tar.gz.

File metadata

  • Download URL: e2me-0.1.2.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.11.15 Linux/6.6.0vtism

File hashes

Hashes for e2me-0.1.2.tar.gz
Algorithm Hash digest
SHA256 aff2270e79c0a51d27318005a63e5a413e71845d1f3f026ffe60c4c22748254e
MD5 6e28b2a90e4ae43cda743fc1b3b6340d
BLAKE2b-256 332cd6d40e63c7a026b5ae21a600553f409475c94bd8e6bf36bc4372f5ff0229

See more details on using hashes here.

File details

Details for the file e2me-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: e2me-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.11.15 Linux/6.6.0vtism

File hashes

Hashes for e2me-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4d32017909475904ecc8c5277401ef50e2a6dd3348f41fbe25231efff39661d8
MD5 ef5f1b13372184f9f92827aefe858dce
BLAKE2b-256 ba95a162db0a6598354349f2f60348aa30f7733db4c92c9bfeee8c8659ea6ef6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page