I'd like to backport a fix from https://github.com/coder/coder/pull/14495. We took heavy inspiration from notify/email/email.go for our SMTP dispatch implementation, but we discovered a fairly nasty bug which is also present in this code.
tl;dr: the email notifier does not correctly close an SMTP submission, which may lead to unsuccessful dispatches being marked as successful.
The details are documented in the above PR.
I'll raise a PR to fix this, but I wanted to first check if the maintainers would accept a new approach towards SMTP testing. In coder/coder I introduced emersion/go-smtp to enable SMTP server mocking (see here). I'd like to do the same here because it'll simplify the tests and does not require maildev+docker.
If there's a way to provoke this behaviour with maildev, please let me know as that would be simpler - but from my cursory scan of the docs it did not seem possible.
I'd like to backport a fix from https://github.com/coder/coder/pull/14495. We took heavy inspiration from
notify/email/email.go
for our SMTP dispatch implementation, but we discovered a fairly nasty bug which is also present in this code.tl;dr: the
email
notifier does not correctly close an SMTP submission, which may lead to unsuccessful dispatches being marked as successful.The details are documented in the above PR.
I'll raise a PR to fix this, but I wanted to first check if the maintainers would accept a new approach towards SMTP testing. In
coder/coder
I introducedemersion/go-smtp
to enable SMTP server mocking (see here). I'd like to do the same here because it'll simplify the tests and does not require maildev+docker.If there's a way to provoke this behaviour with maildev, please let me know as that would be simpler - but from my cursory scan of the docs it did not seem possible.
PS miss you folks at Grafana Labs ❤️