Open zhoud9012 opened 6 years ago
1.go version go1.8.3 linux/amd64 2.cronsun-v0.3.1-linux-amd64 3.开启报警 发送邮件失败 4.希望能成功发送报警邮件 5.我现在的结果是执行任务失败,发送邮件不成功。
为什么发送邮件返回,发送邮件不成功 2018-05-30T17:31:52.277+0800 WARN cronsun/noticer.go:96 close smtp server err: EOF
mail.json
{ "Enable": true, "To": ["xxxx@qq.com"], "#HttpAPI": "如有此字段,则按 http api 方式发送", "#Keepalive": "如果此时间段内没有邮件发送,则关闭 SMTP 连接,单位/秒", "Keepalive": 60, "#doc": "https://godoc.org/github.com/go-gomail/gomail#Dialer", "Host": "smtp.163.com", "Port": 465, "Username": "xxxx@163.com", "Password": "xxxxx", "SSL": true, "#LocalName": "LocalName is the hostname sent to the SMTP server with the HELO command. By default, 'localhost' is sent.", "LocalName": "" }
试下把 SSL 改为 false,或者把 Port 改成 25
我也遇到了这个问题,请问@zhoud9012 解决这个问题了吗?
希望能得到帮助,感谢亲们。
@nicksors 请问你用的是什么邮箱?
@miraclesu 163邮箱
@nicksors , 问题解决了吗?我用最新的cronsun-v0.3.5-linux-amd64.zip, 在docker 环境下也报同样的错误,下面是详细信息: Mac 下的 docker image: centos:7.4.1708
conf/mail.json 配置, 因为mailtrap.io测试账号是用的2525 端口 { "Enable": true, "To": ["xxx@xxx.com"], "#HttpAPI": "如有此字段,则按 http api 方式发送", "#Keepalive": "如果此时间段内没有邮件发送,则关闭 SMTP 连接,单位/秒", "Keepalive": 60, "#doc": "https://godoc.org/github.com/go-gomail/gomail#Dialer", "Host": "smtp.mailtrap.io", "Port": 2525, "Username": "xxx", "Password": "xxx", "SSL": false, "#LocalName": "LocalName is the hostname sent to the SMTP server with the HELO command. By default, 'localhost' is sent.", "LocalName": "localhost" }
@nicksors , 问题解决了吗?我用最新的cronsun-v0.3.5-linux-amd64.zip, 在docker 环境下也报同样的错误,下面是详细信息: Mac 下的 docker image: centos:7.4.1708
conf/mail.json 配置, 因为mailtrap.io测试账号是用的2525 端口 { "Enable": true, "To": ["xxx@xxx.com"], "#HttpAPI": "如有此字段,则按 http api 方式发送", "#Keepalive": "如果此时间段内没有邮件发送,则关闭 SMTP 连接,单位/秒", "Keepalive": 60, "#doc": "https://godoc.org/github.com/go-gomail/gomail#Dialer", "Host": "smtp.mailtrap.io", "Port": 2525, "Username": "xxx", "Password": "xxx", "SSL": false, "#LocalName": "LocalName is the hostname sent to the SMTP server with the HELO command. By default, 'localhost' is sent.", "LocalName": "localhost" }
并没有解决,后面没有继续研究了。
不好意思,我这个问题是因为没有在任务编辑里开启 “报警”的选项,开启后,发现有报错: exit status 1 To:[xxx@xxx.com]}] err: gomail: could not send email 1: gomail: invalid address "bbxxxfe": mail: no angle-addr
"bbxxxfe" 是我在conf/mail.json 配置的 "Username" 的值, 请问下是我哪里的配置有问题吗?
看起来是 cronsun/blob/master/noticer.go 文件 line 86行这里配置的是 Username
的问题,建议在conf/mail.json 增加一个FromEmail
, 然后这里使用m.cf.FromEmail
sm.SetHeader("From", m.cf.Username)
问题解决了吗?
Please answer these questions before submitting your issue. Thanks! 在你提交 issue 前,请先回答以下问题,谢谢!
What version of Go and cronsun version are you using? 你用的是哪个版本的 Go 和 哪个版本的 cronsun?
What operating system and processor architecture are you using (
go env
)? 你用的是哪个操作系统,什么架构的?What did you do? If possible, provide a recipe for reproducing the error. A complete runnable program is good. 你做了什么,遇到了什么问题?尽可能描述清楚问题,最好把操作步骤写下来,按这些步骤操作后能重现你的问题。
What did you expect to see? 你期望得到什么样的结果?
What did you see instead? 现在你得到的结果是什么样的?