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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: e2me-0.0.5.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.5.tar.gz
Algorithm Hash digest
SHA256 8d5e7e34aedfcb0bb23ff2867fb0cd1bc7ec030b4791e0b33288538a8bb21717
MD5 628234f5baa92d9e19e104ecdb98f5bd
BLAKE2b-256 494cfc090b812f42a7400ab13c2e9c029fac27deaeaac9b3143087d93d9bfc58

See more details on using hashes here.

File details

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

File metadata

  • Download URL: e2me-0.0.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e0c88e92b18bea1a91f28815c6096faea67b37d256ce5b2e1cb33f83a6d496c4
MD5 d1d0f214079ddafa3e2c50d97dc4b383
BLAKE2b-256 e767dba1865baf62880ea6ee6e57d74bf02971afc13c10bc5daf9bd7a18739d1

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