如何解决Alertmanager无法通过端口465发送邮件
我正在尝试使用config.yml文件中配置的凭据通过Alertmanager发送电子邮件。
我能够使用587端口通过gmail smtp服务器发送邮件。
但是我的客户正在实时使用465端口,而我却遇到了错误
“第一条记录看起来并不像tls握手”
下面是我的配置文件
route:
receiver: 'notifications-configuration'
#This receiver name can be any userdefined name
templates:
- '/etc/alertmanager/template/emailnotification.tmpl'
#Send the notifications to below receivers.
#There can be single as well as multiple receivers
#Here there are 2 receivers one is for mail and another is for sending notifications to some API provided
receivers:
- name: 'notifications-configuration'
email_configs:
- from: 'samplemailfrom@gmail.com'
auth_username: samplemailfrom@gmail.com'
auth_password: 'fdsfsdfsdfsdssds'
smarthost: 'smtp.gmail.com:587'
auth_identity: 'samplemailfrom@gmail.com'
tls_config:
insecure_skip_verify: true
to: 'samplemailto@gmail.com'
当我将此smtp主机更改为customersmtphost:465时,我遇到了上述错误
我搜索了这个问题并找到了许多链接,但是我无法弄清楚我应该在config.yaml中进行哪些更改以使其起作用
请提供帮助。.预先感谢
解决方法
TLDR:Alertmanager中使用的库不支持端口465
,请使用端口587
。
根据Google's docs,端口465和587做不同的事情:
SSL端口:465
TLS / STARTTLS的端口:587
SSL
端口从一开始就使用TLS连接,而STARTTLS
端口使用的是普通连接,然后将其升级为TLS(请参见wiki on STARTTLS。
Alertmanager使用smtp.Sendmail指出:
SendMail在地址处连接到服务器,并在可能的情况下切换到TLS
这意味着只有STARTTLS方法可用,它不能处理纯TLS。 这将使端口465
无法使用默认的Go sendmail程序包,从而无法使用。 您必须使用端口587
。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。