# Icinga2 Mail Notification Issues

**URL:** <https://community.icinga.com/t/icinga2-mail-notification-issues/7097>\
**Category:** Icinga 2\
**Created:** [April 9, 2021, 3:11pm UTC](https://community.icinga.com/t/icinga2-mail-notification-issues/7097 "2021-04-09T15:11:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![akellar](https://community.icinga.com/user_avatar/community.icinga.com/akellar/32/4083_2.png) [@akellar](https://community.icinga.com/u/akellar)\
**Post date:** [April 9, 2021, 3:11pm UTC](https://community.icinga.com/t/icinga2-mail-notification-issues/7097/1 "2021-04-09T15:11:43Z")

</div>

I have a CentOS 7 machine stood up running an Icinga2 master with several hosts reporting. I have checked out a multitude of topics and cannot seem to find a resolution to my issue. When forcing a custom notification, I receive a mail notification, however, if something goes to critical, Icingaweb2 says it sent a notification but I never receive one. I have looked at many posts over the last couple of days but cannot find a resolution.

I have also read over the notification & notification command documentation but cannot seem to find the cause of my misstep.

Here are some examples of my configuration:

**notification template:**

```
 template Notification "mail-host-notification" {
      command = "mail-host-notification"
      interval = 15m

      states = [Up, Down]
      types = [ Problem, Acknowledgement, Recovery, Custom,
                FlappingStart, FlappingEnd,
                DowntimeStart, DowntimeEnd, DowntimeRemoved ]

      vars += {
        // notification_icingaweb2url = "https://www.example.com/icingaweb2"
        notification_from = "Icinga 2 Host Monitoring <email_changed>"
        notification_logtosyslog = false
      }

      period = "24x7"
    }

    /**
     * Provides default settings for service notifications.
     * By convention all service notifications should import
     * this template.
     */
    template Notification "mail-service-notification" {
      command = "mail-service-notification"
      interval = 15m

      states = [OK, Warning, Critical, Unknown]
      types = [ Problem, Acknowledgement, Recovery, Custom,
                FlappingStart, FlappingEnd,
                DowntimeStart, DowntimeEnd, DowntimeRemoved ]

      vars += {
        // notification_icingaweb2url = "https://www.example.com/icingaweb2"
        notification_from = "Icinga 2 Service Monitoring <email_changed>"
        notification_logtosyslog = false
      }

      period = "24x7"
    }

```

**host example, all configured the same:**

```
object Host "hostname_changed" {
  import "generic-host"
  address = "123.123.123.123"
  vars.agent_endpoint = "hostname_changed"
  vars.os_type = "windows"
  vars.notification["mail"] = {
    groups = ["icingaadmins"]
  }
}

```

**apply rules for notifications**

```
apply Notification "mail-icingaadmin" to Host {
  import "mail-host-notification"
  user_groups = host.vars.notification.mail.groups
  users = host.vars.notification.mail.users

  //interval = 2h

  vars.notification_logtosyslog = true

  command_endpoint = host.vars.agent_endpoint
  assign where host.vars.notification.mail
}

apply Notification "mail-icingaadmin" to Service {
  import "mail-service-notification"
  user_groups = host.vars.notification.mail.groups
  users = host.vars.notification.mail.users

  //interval = 2h

  vars.notification_logtosyslog = true

  command_endpoint = host.vars.agent_endpoint
  assign where host.vars.notification.mail
}

```

**user I configured**

```
object User "username_hidden" {
  display_name = "displayname_hidden"
  enable_notifications = true
  states = [OK, Warning, Critical]
  types = [Problem, Recovery]
  email = "email_hidden"
  groups = ["icingaadmins"]

  vars.notification["mail"] = {
    groups = ["icingaadmins"]
    users = ["icingaadmins", "username_hidden"]
  }
}

object UserGroup "icingaadmins" {
  display_name = "Icinga 2 Admin Group"
}
```

---

<div class="post-metadata">

**Author:** ![akellar](https://community.icinga.com/user_avatar/community.icinga.com/akellar/32/4083_2.png) [@akellar](https://community.icinga.com/u/akellar)\
**Post date:** [April 9, 2021, 9:27pm UTC](https://community.icinga.com/t/icinga2-mail-notification-issues/7097/2 "2021-04-09T21:27:54Z")

</div>

After more investigation, I’ve found that it is sending the notification, but only to the default “icingaadmin” user that comes preconfigured, even though I am specifying both the default user and the user I created with my e-mail.

I have changed the e-mail address of the default user and it now works. I can not figure out why it will not allow me to add a different user to receive e-mails.
