-
Notifications
You must be signed in to change notification settings - Fork 43
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
Implement default email sender #207
Implement default email sender #207
Conversation
da181cb
to
82a492a
Compare
da8d61e
to
887ca4d
Compare
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've reviewed this primarily by comparing to the Grafana code which it same from, looks good. I have left a few questions.
I'd like us to raise a follow-up issue about adding back tracing into the sender, though we can do this later on after integration into Mimir.
receivers/email_sender.go
Outdated
var buffer bytes.Buffer | ||
if err := s.tmpl.ExecuteTemplate(&buffer, cmd.Template, data); err != nil { | ||
return nil, err | ||
} |
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.
The Grafana code here supports providing multiple alternative content types, but we're only doing HTML here. Should we retain text/plan support too?
|
||
func (s *defaultEmailSender) setDefaultTemplateData(data map[string]any) { | ||
data["AppUrl"] = s.cfg.ExternalURL | ||
data["BuildVersion"] = s.cfg.Version |
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.
We don't have BuildStamp
, EmailCodeValidHours
and Name
here, but they're not used in our template so that makes sense.
} | ||
|
||
d := gomail.NewDialer(host, iPort, s.cfg.AuthUser, s.cfg.AuthPassword) | ||
d.TLSConfig = tlsconfig |
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.
We're not setting StartTLSPolicy
here, should we?
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.
Thanks, LGTM!
Description
This PR adds a default email sender that implements the EmailSender interface.
It also includes a function that returns a factory function that can be passed to
BuildReceiverIntegrations
when creating Grafana receivers.This can be smoke-tested using this Mimir PoC.