n9e 6.0-ga6 日志提示邮件问题

Viewed 101

配置告警中,
邮件使用企业微信邮箱,发给QQ邮箱,可以收到邮件,但是n9e中日志提示535?
我看email.go中使用的是gomail.v2,自测时没有发现问题;
不过使用python测试时,又提示“From合法性检查” 需要增加发送名称,且与找好名一致,base64加密;
gomail我看带着base64不设置也是可以发送的。
想问下有遇到此类问题的吗?是腾讯的时,我们需要新做适配?还是其他?

ERROR sender/email.go:85 email_sender: failed to dial smtp: 535 Error: authentication failed, system busy
3 Answers

3》 也不是,可以排除;
在n9e中的email.go中根据平台通知配置中的SMTP设置参数InsecureSkipVerify 关闭了SSL认证。


Host = " "
Port = 50
User = "test@com.cn"
Pass = ""
From = "localhost@com.cn"
InsecureSkipVerify = true
Batch = 5

我自测试关闭SSL是可以正常发信息,没有错误提示;
4》我不确定.go这块我在学习中。

我写了例子想复现但是失败了;以下是我go测试代码:

package main

import (
	"crypto/tls"
	"fmt"

	"gopkg.in/gomail.v2"
)

func main() {
	test1()
}

func test1() {
	message := `
    <p> Hello %s,</p>

		<p style="text-indent:2em">Best of you!</p>
	`

	// QQ 邮箱:
	// SMTP 服务器地址:smtp.qq.com(SSL协议端口:465/994 | 非SSL协议端口:25)
	// 163 邮箱:
	// SMTP 服务器地址:smtp.163.com(端口:25)
	host := "smtp.exmail.qq.com"
	port := 465
	userName := "邮箱账号"
	password := "密码"

	m := gomail.NewMessage()
	//m.SetHeader("From", userName) // 发件人
	//m.SetHeader("From", "alias" + " <"+userName+">") // 增加发件人别名
	m.SetAddressHeader("From", userName, "alias") // 增加发件人别名

	m.SetHeader("To", "收件人邮箱") // 收件人,可以多个收件人,但必须使用相同的 SMTP 连接
	//m.SetHeader("Cc", "******@qq.com")    // 抄送,可以多个
	//m.SetHeader("Bcc", "******@qq.com")   // 暗送,可以多个
	m.SetHeader("Subject", "Hello!") // 邮件主题

	// text/html 的意思是将文件的 content-type 设置为 text/html 的形式,浏览器在获取到这种文件时会自动调用html的解析器对文件进行相应的处理。
	// 可以通过 text/html 处理文本格式进行特殊处理,如换行、缩进、加粗等等
	m.SetBody("text/html", fmt.Sprintf(message, "testUser"))

	// text/plain的意思是将文件设置为纯文本的形式,浏览器在获取到这种文件时并不会对其进行处理
	// m.SetBody("text/plain", "纯文本")
	// m.Attach("test.sh")   // 附件文件,可以是文件,照片,视频等等
	// m.Attach("lolcatVideo.mp4") // 视频
	// m.Attach("lolcat.jpg") // 照片

	d := gomail.NewDialer(
		host,
		port,
		userName,
		password,
	)
	// 关闭SSL协议认证
	d.TLSConfig = &tls.Config{InsecureSkipVerify: true}

	if err := d.DialAndSend(m); err != nil {
		panic(err)
	}
}

@大禾 谢了,问题应确认了。
昨天测试机机房出现问题重启了,重启之后关于email的异常没有了,任何配置都没有调整;