When icinga2 sends out emails, it sets the environment variable
The same environment variable is used by
nullmailer but with different
semantics. This breaks email sending…
The environment variable
HOSTNAME is usually set by your
NotificationCommand definition for email notfications by icinga.
HOSTNAME contains the name of the host that was the source of
When icinga2 wants to send a notification it will then execute the
defined command, which by default is the script
That script calls the
sendmail command which can be picked up by
sendmail is usually a symlink to
Now unfortunately nullmailer understands the same environment
HOSTNAME as meaning “please set the mail domain of
the sender” to the contents of
nullmailer will probably set the enveloppe sender to
firstname.lastname@example.org, nagios being the user
as which the
icinga2 process is running.
The result in
/var/log/mail.log looks like this:
Nov 27 16:49:05 monserver nullmailer: smtp: Failed: 550-Verification failed for <email@example.com>#012550-Unrouteable address#012550 Sender verification failed
There are various ways to work around this problem. One is to
MAILFROM environment variable in your
definition. However for some reason (maybe the dispatching logic
this wouldn't work.
So in the end I set the
NULLMAILER_HOST environment variable inside
NotificationCommand definition, which, for nullmailer, has a
higher precedence than the
HOSTNAME variable and thus overrides it.