From 7db81cde444f6bc95e79527af0997de1788d48c7 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Sun, 19 Mar 2023 13:11:46 +0100 Subject: [feature] Email notifications for new / closed moderation reports (#1628) * start fiddling about with email sending to allow multiple recipients * do some fiddling * notifs working * notify on closed report * finishing up * envparsing * use strings.ContainsAny --- internal/email/confirm.go | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) (limited to 'internal/email/confirm.go') diff --git a/internal/email/confirm.go b/internal/email/confirm.go index a6548e7d1..9f05a4f71 100644 --- a/internal/email/confirm.go +++ b/internal/email/confirm.go @@ -17,15 +17,8 @@ package email -import ( - "bytes" - "net/smtp" - - "github.com/superseriousbusiness/gotosocial/internal/gtserror" -) - const ( - confirmTemplate = "email_confirm_text.tmpl" + confirmTemplate = "email_confirm.tmpl" confirmSubject = "GoToSocial Email Confirmation" ) @@ -43,20 +36,5 @@ type ConfirmData struct { } func (s *sender) SendConfirmEmail(toAddress string, data ConfirmData) error { - buf := &bytes.Buffer{} - if err := s.template.ExecuteTemplate(buf, confirmTemplate, data); err != nil { - return err - } - confirmBody := buf.String() - - msg, err := assembleMessage(confirmSubject, confirmBody, toAddress, s.from) - if err != nil { - return err - } - - if err := smtp.SendMail(s.hostAddress, s.auth, s.from, []string{toAddress}, msg); err != nil { - return gtserror.SetType(err, gtserror.TypeSMTP) - } - - return nil + return s.sendTemplate(confirmTemplate, confirmSubject, data, toAddress) } -- cgit v1.2.3