diff --git a/doc/Extensions/Alerting.md b/doc/Extensions/Alerting.md index cf2061595b..8d98af7bc8 100644 --- a/doc/Extensions/Alerting.md +++ b/doc/Extensions/Alerting.md @@ -192,6 +192,11 @@ $config['alert']['admins'] = true; //Include Administrators into alert-contacts > You can configure these options within the WebUI now, please avoid setting these options within config.php +For all but the default contact, we support setting multiple email addresses separated by a comma. So you can +set the devices sysContact, override the sysContact or have your users emails set like: + +`email@domain.com, alerting@domain.com` + E-Mail transport is enabled with adding the following to your `config.php`: ~ ```php diff --git a/includes/alerts.inc.php b/includes/alerts.inc.php index 3e1da0b687..c18131f3bc 100644 --- a/includes/alerts.inc.php +++ b/includes/alerts.inc.php @@ -281,5 +281,20 @@ function GetContacts($results) { $contacts[$user['email']] = $user['realname']; } } - return $contacts; + + $tmp_contacts = array(); + foreach ($contacts as $email => $name) { + if (strstr($email, ',')) { + $split_contacts = preg_split("/[,\s]+/", $email); + foreach ($split_contacts as $split_email) { + if(!empty($split_email)) { + $tmp_contacts[$split_email] = $name; + } + } + } else { + $tmp_contacts[$email] = $name; + } + } + + return $tmp_contacts; }