Added support for multiple emails #3885

Merged
merged 3 commits into from Jul 28, 2016

Projects

None yet

3 participants

@laf
Member
laf commented Jul 26, 2016

Fix #3860

Doesn't work with default contact - you should set an alias to be used on your email server here.

But users, sysContact and sysContact override can all have comma separated emails.

laf added some commits Jul 26, 2016
@laf laf Added support for multiple emails 0e197e9
@laf laf Updated alerting doc
c162b42
@murrant murrant commented on the diff Jul 27, 2016
includes/alerts.inc.php
@@ -281,5 +281,18 @@ 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);
@murrant
murrant Jul 27, 2016 Contributor

Accidental leading or or trailing whitespace will cause empty entries in $split_contacts. Probably should trim() or check for empty emails.

Or maybe it doesn't matter?

@laf
laf Jul 28, 2016 Member

Done

@laf laf Added check for empty emails
17d9318
@murrant murrant merged commit 8553646 into librenms:master Jul 28, 2016

2 checks passed

Auto-Deploy Build finished.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@laf laf deleted the laf:issue-3860 branch Jul 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment