feature: Send default mail when no email destinations found (#6165)

* when an email is attempted to be sent but there are no recipients send to default_mail address
This commit is contained in:
towster
2017-03-14 18:22:43 -05:00
committed by Neil Lathwood
parent cca6cbb1af
commit 605b9d2092
3 changed files with 10 additions and 0 deletions

View File

@@ -253,6 +253,10 @@ $general_conf = array(
'descr' => 'Default contact',
'type' => 'text',
),
array('name' => 'alert.default_if_none',
'descr' => 'Send mail to default contact if no other contacts are found',
'type' => 'checkbox',
),
array('name' => 'alert.tolerance_window',
'descr' => 'Tolerance window for cron',
'type' => 'text',

View File

@@ -294,5 +294,10 @@ function GetContacts($results)
}
}
# Send email to default contact if no other contact found
if ((count($tmp_contacts) == 0) && ($config['alert']['default_if_none']) && (!empty($config['alert']['default_mail']))) {
$tmp_contacts[$config['alert']['default_mail']] = 'NOC';
}
return $tmp_contacts;
}

1
sql-schema/177.sql Normal file
View File

@@ -0,0 +1 @@
INSERT INTO config (config_name,config_value,config_default,config_descr,config_group,config_group_order,config_sub_group,config_sub_group_order,config_hidden,config_disabled) values ('alert.default_if_none','false','false','Send mail to default contact if no other contacts are found','alerting',0,'general',0,'0','0');