Closed chinglinwen closed 7 years ago
re-produce step (the following is how I do it) :
I've print the body inside maild (incase prevent other issues), it show body is correctly transfer to gomail
deploy maild on localhost
execute following testing shell code:
email () {
curl -s -F "receiver=$1" \
-F "subject=$2" \
-F "body=$3" \
http://localhost:3001/
}
receiver="wzlwen@qq.com" body="[2017-06-19_11:29:54] - restart spider-go-api [2017-06-19_11:29:54] - all service is ok. [2017-06-19_11:31:06] - checks done. [2017-06-19_11:54:26] - checks done. [2017-06-19_11:54:36] - restart spider-go-api [2017-06-19_11:54:38] - spider-go-api is STOPPED, sent to wzlwen@qq.com [2017-06-19_11:54:38] - checks done. [2017-06-19_11:55:36] - restart spider-go-api [2017-06-19_11:55:37] - spider-go-api is STOPPED, sent to wzlwen@qq.com [2017-06-19_11:55:37] - checks done."
email "$receiver" "app is $status" "$body"
It's okay, I change SetBody("text/html", body) to SetBody("text/plain", body), fixed this issue.
code: https://github.com/chinglinwen/maild
Say following code
I've try print the body value, it's included newline, but the received mail body doesn't have newline
use smtp port 587
version: gopkg.in/gomail.v2