tmpmail - 来自终端的临时电子邮件,用 POSIX sh 编写

Created at: 2020-09-13 19:21:50
Language: Shell
License: MIT

来自终端的临时电子邮件,用 POSIX sh 编写


tmpmail
是一个用 POSIX 编写的命令行实用程序,
sh
它允许你创建一个临时电子邮件地址并接收电子邮件到临时电子邮件地址。它使用 1secmail 的API 来接收电子邮件。

默认情况下

w3m
用于在终端上呈现 HTML 电子邮件。但是,如果你更喜欢其他基于文本的 Web 浏览器,或者更愿意在 GUI Web 浏览器(例如 Firefox)中查看电子邮件,只需使用
--browser
参数后跟启动你选择的 Web 浏览器所需的命令即可。




依赖关系

  • w3m
  • curl
  • jq

安装

本地安装

# Download the tmpmail file and make it executable
$ curl -L "https://git.io/tmpmail" > tmpmail && chmod +x tmpmail

# Then move it somewhere in your $PATH. Here is an example:
$ mv tmpmail ~/bin/

AUR

tmpmail
可在AUR上获得,目前由Benjamin Bädorf维护

$ yay -S tmpmail-git

尼克斯

tmpmail
也可以在由legendofmiracles维护的nix包集合中(目前仅不稳定)

将它添加到你的系统包中,使用 nix-env 安装它或在临时的 nix-shell 中试用它

nix-shell -p tmpmail

docker

要求:

$ docker build -t mail .; # Dockerfile available in source code
$ docker run -it mail /bin/bash; 

用法

$ tmpmail --help
tmpmail
tmpmail -h | --version
tmpmail -g [ADDRESS]
tmpmail [-t | -b BROWSER] -r | ID

When called with no option and no argument, tmpmail lists the messages in
the inbox and their numeric IDs.  When called with one argument, tmpmail
shows the email message with specified ID.

-b, --browser BROWSER
        Specify BROWSER (default: w3m) that is used to render the HTML of
        the email
-g, --generate [ADDRESS]
        Generate a new email address, either the specified ADDRESS, or
        randomly create one
-h, --help
        Show help
-r, --recent
        View the most recent email message
-t, --text
        View the email as raw text, where all the HTML tags are removed.
        Without this option, HTML is used.
--version
        Show version

例子

创建随机电子邮件

$ tmpmail --generate
xoithrjagpx@1secmail.net

创建自定义电子邮件

$ tmpmail --generate mycustomemail@1secmail.com
mycustomemail@1secmail.com

查看收件箱

$ tmpmail
[ Inbox for wdebivbyjor@1secmail.com ]

83414443   username@example.com   Test Email

查看电子邮件

$ tmpmail 83414443

查看最近的电子邮件

$ tmpmail -r

以纯文本形式查看电子邮件

$ tmpmail -t 83414443
To: wdebivbyjor@1secmail.com
From: username@example.com
Subject: Test Email

Hello World

[Attachments]
https://is.gd/aBCdEf [apple.jpg]
https://is.gd/AbCDeF [ball.jpg]

捐赠

这个剧本的灵感来自 Mitch Weaver 的

1secmail
剧本