comman-line发送邮件

简介

偶尔会遇到需要在服务器上发送邮件的场景。这种情况下一般都是通过python脚本来完成,但对于某些没有python环境的机器或不熟悉pyhton的人员,未免有些麻烦。因此,就有的本工具的诞生。

这个简陋的command-line工具是基于我的另一篇文章中提供的库--emailagent,也算是一个代码使用的示例。并且它的代码库也在那里--example

下载

地址:email 已编译文件直接放在exmaple里面,直接下载即可。

Usage

config.toml

Host = "smtp.aliyun.com"
Port = 465
IsSSL = true
User ="exmaple@aliyun.com"
NickName = "nick"
Password = ""


command

./email plain/html <email_body_file> [<flags>]

$ go build -o email main.go
$ ./email plain email.txt -c config.toml -s 'email for test' -t exmaple1@aliyun.com -t exmaple2@aliyun.com -a attachment_file -a another_attachment_file
$ ./email html email.html -c config.toml -s 'test for sending html' -t example@aliyun.com
$ ./email --help

usage: email --conf=CONF --to=TO --subject=SUBJECT [<flags>] <type> <content-file>

Flags:
      --help               Show context-sensitive help (also try --help-long and --help-man).
  -c, --conf=CONF          authuration configuraion
  -a, --attach=ATTACH ...  attach file
  -t, --to=TO ...          target
  -s, --subject=SUBJECT    email subject

Args:
  <type>          content type
  <content-file>  content body


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值