Email is a command line program that can send attachments, and stdin as the body of an email. It's most useful as a way of emailing yourself files.
go get github.com/nwjlyons/email
Copy and paste into a terminal and update values accordingly.
mkdir -p ~/.config/email;cat > ~/.config/email/config.json <<EOF
{
"mailbox": "[email protected]",
"from": "[email protected]",
"host": "smtp.gmail.com",
"port": "587",
"password": "",
"to": [
"[email protected]"
],
"subject": ""
}
EOF
;vi ~/.config/email/config.json
Body from command line flag
email -b "body"
or from a pipe
echo "body" | email
or from stdin
email < file.txt
email attachment.pdf attachment.jpg
Override recipients from settings file. Accepts a comma separated list.
email -t "[email protected]" -b "body"
multiple recipients
email -t "[email protected],[email protected]" -b "body"
Override subject from settings file
email -s "subject" -b "body"
email -t "[email protected]" -s "Some photos from the weekend" dinner.jpg tokyo-skyline.jpg
email -c ~/config.json -b "body" -s "subject"
- Install
godep
with this commandgo get github.com/tools/godep
. - Prefix go commands on the terminal with
godep
. eg instead ofgo test
rungodep go test
.
To run tests
godep go test
These tests will actually send an email using the settings in your config file. To avoid this set EMAIL_SEND
enviroment variable to 0
.
EMAIL_SEND=0 godep go test