Postman批量发送email
安装使用
go get github.com/zachlatta/postman
postman -html template.html -text template.txt -csv recipients.csv -sender "[email protected]" -subject "hello world" -server smtp.mxhichina.com -port 25 -user "[email protected]" -password "密码" -attach we.png,a.jpg
使用注意
template.html:
类似这样的<h1>Hello, {{.Name}}! You are a {{.Type}}</h1>
可以写成markdown文件然后转成html。要用html发送的话必须有-text参数(也许是个bug)。
这里的变量Name和Type来自recipients.csv文件的,方便针对性的发邮件。template.txt:
类似这样的Hello, {{.Name}}! You are a {{.Type}}.
发送正文用txt即文本时,只需-text参数,不需要-html参数。
attach 为逗号分割附件名
recipients.csv
csv表格文件,Email是必须的,其他根据信件内容随时可以添加。
Email,Name,Type
[email protected],Arthur Dent,Human
[email protected],Ford Prefect,Alien
[email protected],Martin,Robot
[email protected],Trillian,Human
A small favor
Was anything I wrote confusing, outdated, or incorrect? Please let me know! Just write a few words below and I'll be sure to amend this post with your suggestions.
Follow along
If you want to know about new posts, add your email below. Alternatively, you can subscribe with RSS.