Skip to main content

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

Project description

e2me

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

pip install e2me

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

快速开始

需要在运行程序的服务器端编写一个配置文件, 可以通过 e2me init 自动生成 e2me.toml, 如下所示

[email]
email = "your_email@example.com"
passwd = "your_password"

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

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

其中 email 改为您的邮箱地址, 注意这里的密码并不是邮箱的登录密码, 注意这里的密码并不是邮箱的登录密码, 注意这里的密码并不是邮箱的登录密码, 而是需要开启邮箱的 SMTP/POP3 服务后分配给你的密码

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

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

发送邮件

e2me run

subject 为邮件标题, body 为邮件正文内容, 默认提供了 5 个基本宏用于系统信息的记录

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

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

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

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

e2me run

对于 python 程序您可以直接使用该库发送邮件

import e2me

def main():
    # do something

    # finish
    e2me.run()

或者对于其他语言, 调用 execve 执行 e2me run

#include <stdio.h>
#include <unistd.h>
int main(int argc, char **argv) {

    char *args[3] = {"e2me","run", NULL};
    // whereis e2me 找到绝对路径
    execve("/home/kamilu/anaconda3/bin/e2me", args, NULL);
    return 0;
}

接收邮件

e2me get

邮箱基本信息

# 协议  服务器         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.0.4.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

e2me-0.0.4-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: e2me-0.0.4.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.9 Windows/10

File hashes

Hashes for e2me-0.0.4.tar.gz
Algorithm Hash digest
SHA256 a7c6bf97c85965653ac78121217eb8de702c62299bb13f5b67aaaa2c9cab894b
MD5 12fead8c7260622312ae80c65a2b446a
BLAKE2b-256 053c2959f80311500d0fcbc4af6c9e01c115bb18cffdb40de74c04644a496fbb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: e2me-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.9 Windows/10

File hashes

Hashes for e2me-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 96a4e797f13740420f576133cc9bc84ed2fa99422bdcfc8cb45e62c08a779091
MD5 5393145eed7710b8ca04ab71a0ca7999
BLAKE2b-256 df176dfc4ef07271d1c01477375a82fb95c2edc14869dc214ffe082b72071714

See more details on using hashes here.

Supported by

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