beginner
beginner

Reputation: 61

Alertmanager not able send mails via port 465

I am trying to send email via alertmanager using credential configured in config.yml file.

I am able to send mail via gmail smtp server using port 587.

But in realtime my customer is using 465 port and I am getting below error

"first record does not look like a tls handshake"

Below is my config file

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: '[email protected]'
         auth_username: [email protected]'
         auth_password: 'fdsfsdfsdfsdssds'
         smarthost: 'smtp.gmail.com:587'
         auth_identity: '[email protected]'
         tls_config:
           insecure_skip_verify: true
         to: '[email protected]'

When I change this smtp host to the the customersmtphost:465 I am getting above mentioned errors

I googled for this issue and Found many links but I am not able to figure it out what change should I do in config.yaml to make it work

Please help on the same.. Thanks in advance

Upvotes: 1

Views: 1912

Answers (1)

Marc
Marc

Reputation: 21055

TLDR: Port 465 is not supported by the library used in Alertmanager, use port 587.

Ports 465 and 587 do different things, per Google's docs:

Port for SSL: 465

Port for TLS/STARTTLS: 587

The SSL port uses a TLS connection from the get-go, whereas the STARTTLS port uses a plain connection that is then upgraded to TLS (see wiki on STARTTLS.

Alertmanager uses smtp.Sendmail which states:

SendMail connects to the server at addr, switches to TLS if possible

This means that only the STARTTLS method is available, it cannot handle plain TLS. This makes port 465 unusable with the default Go sendmail package and thus alertmanager. You must use port 587.

Upvotes: 1

Related Questions