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.6.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

e2me-0.0.6-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: e2me-0.0.6.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.6.tar.gz
Algorithm Hash digest
SHA256 c4d89449fbe34a505c6c2ee2bdd93de94d34cd627f418a347f9d889fac5c704f
MD5 954855851c641d07fb1ff9b6aa623257
BLAKE2b-256 f2d5814f15319f84493ebb01121d8bd21c46c99d6496a8fad7b18674fc4e9fb7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: e2me-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 11.1 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 8ca3a9ce00a5883551fb73140b639e945ee06183fd3b937b587b4be445b4d66a
MD5 20a6ef72b73c5dcc62d15f2cb7cd0db9
BLAKE2b-256 56053da9ac862f14c82db721b38de677a885da94d812036c9102bbea88352b2a

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