偶尔会遇到须要在服务器上发送邮件的场景。这种状况下通常都是经过python脚原本完成,但对于某些没有python环境的机器或不熟悉pyhton的人员,未免有些麻烦。所以,就有的本工具的诞生。html
这个简陋的command-line工具是基于个人另外一篇文章中提供的库--emailagent,也算是一个代码使用的示例。而且它的代码库也在那里--example。python
地址:email 已编译文件直接放在exmaple里面,直接下载便可。git
Host = "smtp.aliyun.com" Port = 465 IsSSL = true User ="exmaple@aliyun.com" NickName = "nick" Password = ""
./email plain/html <email_body_file> [<flags>]github
$ 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