pymail:在终端发送邮件

pymail 是一个 Python3 脚本,用于在终端中发送邮件,主要使用 smtplib 库。在日常科研工作中,有时一个程序要运行好几天才能出结果,我使用这个脚本在进程结束后把数据发送到自己的笔记本上,节省了大量等待时间。使用方式很简单:把脚本复制到任意目录,并软链接到 $PATH 中的目录(如 /usr/local/bin),重新打开终端即可使用。 配置 首先,可能需要将脚本第一行修改为你的 python3 所在目录。然后按如下方式修改默认设置: userName = 'username of your mail box' passWord = 'application specific password of your mail box' toAddress = ['default receiving e-mail address'] subJect = 'default subject' textMsg = 'default message.' 用法 pymail [-a<to_address>,<to_address>,...|-A<address-file>] [-s<subject>] [-t<text>|-T<text-file>] [-f<attached_file>,<attached_file>,...] [-h] [-d] 选项说明 -a / –to-address:收件地址,用逗号分隔。 -A / –ads-file:从文件读取收件地址,文件中地址也用逗号分隔。 -s / –subject:邮件主题。 -t / –text:邮件正文。 -T / –text-file:从文件读取正文。 -f / –att-file:附件文件名,用逗号分隔。 -h / –help:显示帮助信息。 -d / –defaults:显示默认设置。 下载 pymail.zip

November 14, 2018 · 1 分钟 · 78 字 · 张壹