Alertmanager Text only emails no longer working

81 views
Skip to first unread message

Mike H

unread,
Nov 15, 2022, 10:04:49 AM11/15/22
to Prometheus Users
Hi all,
Hoping someone can help or offer some insight.
Upgraded from Alertmanager v0.20.0 to v0.23.0
We have a Monitoring Events system that can only auto process text based emails which it uses to generate Incident tickets.
In v0.20.0 we just set html:'' , this no longer seems to be working on v0.23.0 or v0.24.0
by default Alertmanager adds in html: '{{ template "email.default.html" . }}'.
We send 2 emails, 1 with a custom html template to the k8s team and one with a custom text template to the monitoring system:
Config is as follows:
global:
  smtp_auth_password: **************
  smtp_auth_username: *****@mycompany.com
  resolve_timeout: 5m
  smtp_from: k8s.aler...@mycompany.com
  smtp_smarthost: auth-forwarder.mycompany.com:25

receivers:
  - name: email-receiver
    email_configs:
    - headers:
        subject: '{{ template "__subject" . }}'
      html: '{{ template "email.custom.html" . }}'
      send_resolved: false
      to: k8s-...@mycompany.com

  - name: ITSM-receiver
    email_configs:
      - to: monitori...@mycompany.com
        send_resolved: false
        headers:
          subject: '{{ template "__subject" . }}'
        html: ''
        text: '{{ template "email.custom.txt" . }}'

route:
  group_by:
  - alertname
  group_interval: 5m
  group_wait: 30s
  receiver: email-receiver
  repeat_interval: 2h


  routes:
  - receiver: 'email-receiver'
    matchers:
      - alertname=".+"
      - severity="warning|critical"
  - receiver: 'ITSM-receiver'
    matchers:
      - alertname=".+"
      - severity="warning|critical"
templates:
- /etc/alertmanager/configmaps/alert-template/*.tmpl


Has the option of using html:''  been removed from the latest versions or is there a way around this.

Brian Candler

unread,
Nov 15, 2022, 1:04:21 PM11/15/22
to Prometheus Users
I wonder if it relates to this in 0.24.0 changelog?
* [BUGFIX] Fix the default HTML email template (`email.default.html`) to match with the canonical source. #2798

I haven't tried it, but what happens if you set this?

html: "{{/*empty*/}}"

Sadly, I suspect you will get a multipart/alternative mail with empty html section.

The source code in notify/email/email.go says:

        if len(n.conf.HTML) > 0 {

However if the parameter is being set by default to '{{ template "email.default.html" . }}' then it could negate this.
Reply all
Reply to author
Forward
0 new messages