Commit 4999fff2 by Torkel Ödegaard

fix(alerting): fixed email notification so it splits email address multiple ways, fixes #6353

parent b32bbbd1
...@@ -29,9 +29,18 @@ func NewEmailNotifier(model *m.AlertNotification) (alerting.Notifier, error) { ...@@ -29,9 +29,18 @@ func NewEmailNotifier(model *m.AlertNotification) (alerting.Notifier, error) {
return nil, alerting.ValidationError{Reason: "Could not find addresses in settings"} return nil, alerting.ValidationError{Reason: "Could not find addresses in settings"}
} }
// split addresses with a few different ways
addresses := strings.FieldsFunc(addressesString, func(r rune) bool {
switch r {
case ',', ';', '\n':
return true
}
return false
})
return &EmailNotifier{ return &EmailNotifier{
NotifierBase: NewNotifierBase(model.Id, model.IsDefault, model.Name, model.Type, model.Settings), NotifierBase: NewNotifierBase(model.Id, model.IsDefault, model.Name, model.Type, model.Settings),
Addresses: strings.Split(addressesString, `;`), Addresses: addresses,
log: log.New("alerting.notifier.email"), log: log.New("alerting.notifier.email"),
}, nil }, nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment