summaryrefslogtreecommitdiff
path: root/internal/email/test.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-03-19 13:11:46 +0100
committerLibravatar GitHub <noreply@github.com>2023-03-19 13:11:46 +0100
commit7db81cde444f6bc95e79527af0997de1788d48c7 (patch)
treef6c077ec298a4f018d0870798bc46bd64ba70069 /internal/email/test.go
parent[docs] Update docs on how to login (#1626) (diff)
downloadgotosocial-7db81cde444f6bc95e79527af0997de1788d48c7.tar.xz
[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
Diffstat (limited to 'internal/email/test.go')
-rw-r--r--internal/email/test.go26
1 files changed, 2 insertions, 24 deletions
diff --git a/internal/email/test.go b/internal/email/test.go
index 1e411f161..7d6ac2b3b 100644
--- a/internal/email/test.go
+++ b/internal/email/test.go
@@ -17,15 +17,8 @@
package email
-import (
- "bytes"
- "net/smtp"
-
- "github.com/superseriousbusiness/gotosocial/internal/gtserror"
-)
-
const (
- testTemplate = "email_test_text.tmpl"
+ testTemplate = "email_test.tmpl"
testSubject = "GoToSocial Test Email"
)
@@ -39,20 +32,5 @@ type TestData struct {
}
func (s *sender) SendTestEmail(toAddress string, data TestData) error {
- buf := &bytes.Buffer{}
- if err := s.template.ExecuteTemplate(buf, testTemplate, data); err != nil {
- return err
- }
- testBody := buf.String()
-
- msg, err := assembleMessage(testSubject, testBody, 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(testTemplate, testSubject, data, toAddress)
}