-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: enhance email notification to send alerts to multiple recipients #174
base: dev
Are you sure you want to change the base?
feat: enhance email notification to send alerts to multiple recipients #174
Conversation
Email alerts can take a set of email addresses separated by comma
after staring at this for a bit, I think the use of
and it would just set the header to that. according to RFC5322, section 3.4, all of those are valid email header contents. with also see |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tested this at all yet, but I like the suggestion (with some minor changes :b)
notifiers/email.go
Outdated
tempSplit := strings.Split(email.To, ",") | ||
addresses := make([]string, len(tempSplit)) | ||
for i := range addresses { | ||
addresses[i] = m.FormatAddress(tempSplit[i], "") | ||
} | ||
m.SetHeader("To", addresses...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haven't tested this, I'm thinking of something like
tempSplit := strings.Split(email.To, ",") | |
addresses := make([]string, len(tempSplit)) | |
for i := range addresses { | |
addresses[i] = m.FormatAddress(tempSplit[i], "") | |
} | |
m.SetHeader("To", addresses...) | |
addresses := strings.Split(email.To, ",") | |
m.SetHeader("To", addresses...) |
(see my long comment from earlier)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jemand771 Thanks for the suggestions. I did get to test your proposed changes as well as the earlier version, both of the cases it does work fine with various email formats, however since your proposed changes are more succinct I agree it makes more sense to use that version. Thank you again for helping to review this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jemand771 Please review the updated PR.
This PR enhances the email notification functionality where email alerts can now take a set of email addresses separated by comma.
This is related to this github issue #171