Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

报警发送邮件失败! WARN cronsun/noticer.go:96 close smtp server err: EOF #87

Open
zhoud9012 opened this issue May 30, 2018 · 10 comments

Comments

@zhoud9012
Copy link

Please answer these questions before submitting your issue. Thanks!
在你提交 issue 前,请先回答以下问题,谢谢!

  1. What version of Go and cronsun version are you using?
    你用的是哪个版本的 Go 和 哪个版本的 cronsun?

  2. What operating system and processor architecture are you using (go env)?
    你用的是哪个操作系统,什么架构的?

  3. What did you do?
    If possible, provide a recipe for reproducing the error.
    A complete runnable program is good.
    你做了什么,遇到了什么问题?尽可能描述清楚问题,最好把操作步骤写下来,按这些步骤操作后能重现你的问题。

  4. What did you expect to see?
    你期望得到什么样的结果?

  5. What did you see instead?
    现在你得到的结果是什么样的?

@zhoud9012
Copy link
Author

zhoud9012 commented May 30, 2018

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": ["[email protected]"],
"#HttpAPI": "如有此字段,则按 http api 方式发送",
"#Keepalive": "如果此时间段内没有邮件发送,则关闭 SMTP 连接,单位/秒",
"Keepalive": 60,
"#doc": "https://godoc.org/github.com/go-gomail/gomail#Dialer",
"Host": "smtp.163.com",
"Port": 465,
"Username": "[email protected]",
"Password": "xxxxx",
"SSL": true,
"#LocalName": "LocalName is the hostname sent to the SMTP server with the HELO command. By default, 'localhost' is sent.",
"LocalName": ""
}

@zhoud9012 zhoud9012 changed the title 1.cronsun-v0.3.1-linux-amd64 2.centos7 3.go version go1.8.3 linux/amd64 4.WARN cronsun/noticer.go:96 close smtp server err: EOF WARN cronsun/noticer.go:96 close smtp server err: EOF May 30, 2018
@zhoud9012 zhoud9012 changed the title WARN cronsun/noticer.go:96 close smtp server err: EOF 报警发送邮件失败! WARN cronsun/noticer.go:96 close smtp server err: EOF May 30, 2018
@Doflatango
Copy link
Collaborator

试下把 SSL 改为 false,或者把 Port 改成 25

@nicksors
Copy link

nicksors commented Jun 4, 2018

我也遇到了这个问题,请问@zhoud9012 解决这个问题了吗?

  1. 上诉ssl改为false方法已经测试,不行;
  2. 我本身使用的是Mac虚拟的CentOS7虚拟机系统。

希望能得到帮助,感谢亲们。

@miraclesu
Copy link
Collaborator

@nicksors 请问你用的是什么邮箱?

@nicksors
Copy link

@miraclesu 163邮箱

@neilzhou
Copy link

@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": ["[email protected]"],
"#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
Copy link

@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": ["[email protected]"],
"#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"
}

并没有解决,后面没有继续研究了。

@neilzhou
Copy link

不好意思,我这个问题是因为没有在任务编辑里开启 “报警”的选项,开启后,发现有报错:
exit status 1 To:[[email protected]]}] err: gomail: could not send email 1: gomail: invalid address "bbxxxfe": mail: no angle-addr

"bbxxxfe" 是我在conf/mail.json 配置的 "Username" 的值, 请问下是我哪里的配置有问题吗?

@neilzhou
Copy link

看起来是 cronsun/blob/master/noticer.go 文件 line 86行这里配置的是 Username 的问题,建议在conf/mail.json 增加一个FromEmail, 然后这里使用m.cf.FromEmail
sm.SetHeader("From", m.cf.Username)

@214031230
Copy link

问题解决了吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants