Skip to content
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

Question: SMTP Email Notification multiple email addresses #171

Open
bbarman4u opened this issue Sep 6, 2022 · 7 comments · May be fixed by #174
Open

Question: SMTP Email Notification multiple email addresses #171

bbarman4u opened this issue Sep 6, 2022 · 7 comments · May be fixed by #174
Labels
Improvement An Improvement of an already implemented feature

Comments

@bbarman4u
Copy link

First of all thank you for the great work in developing and maintaining this impressive product !
I had a question on if this is supported somehow already in the product or if its planned for implementation where we could have a configurable setting to send emails to multiple recipients having mulitple email addresses, may be separated by comma or semicolon. Today the email plugin seems like only supports one email address.

Additionally it would be great if we could define the recipients at a per service group or even at the service level so that multiple interested parties could get notified depending on their needs instead of sending emails to a shared graveyard email box :)
e.g. certain developers or teams might be only interested in their products or websites so it makes sense to have them subscribe to only that product's notification.

@adamboutcher kindly suggest if this is possible in the current version or does it require enahncements ?

@GPh83
Copy link

GPh83 commented Sep 16, 2022

I agree and want the same.

Thanks for your work !

@jemand771
Copy link
Member

good suggestion; this may (like everything else) take a bit to get implemented unless someone shoots us a PR. as a somewhat hacky workaround, you could set up your own mail server and use that to forward emails. not a real solution, but at least something if you really need multiple recipients

@jemand771 jemand771 added the Improvement An Improvement of an already implemented feature label Sep 16, 2022
@bbarman4u
Copy link
Author

I am not a go expert (still learning it), but here was a simple solution I came up with and tested the solution on my local instance of statping-ng using docker. I was able to rebuild the docker image for testing but having a hard time getting the make files to work for a full build rebuild, hence I am not submitting a PR back to the main repo just yet.

But here is a change in the notifiers/email.go that if implemented allows multiple email addresses to be accepted while being comma separated.


	//m.SetHeader("To", email.To) 
	//For sending to multiple recipients comma separated
	tempSplit := strings.Split(email.To, ",")
	addresses := make([]string, len(tempSplit))
	for i := range addresses {
		addresses[i] = m.FormatAddress(tempSplit[i], "")
	}
        m.SetHeader("To", addresses...)

@adamboutcher
Copy link
Collaborator

Yeah I think a recent change might have broken the full build make as its slight different (inherited some silly things).

However that looks like a sensible change... Try and PR it and we can look at merging.

Thank you for your help!

@bbarman4u
Copy link
Author

@adamboutcher @jemand771 here is the PR with the above mentioned change. Please review and let me know if any other details would be needed. #174

@bbarman4u
Copy link
Author

@jemand771 Just following up to check if any other requirements need to be met before completing the above PR?

@jemand771
Copy link
Member

thanks for checking in; there's nothing left to do on your side for now. this is mainly blocked by me being lazy, I'll try to look at it soon™
(yeah I know I said that last time)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement An Improvement of an already implemented feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants