mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[feature] Allow admins to send test emails (#1620)
* [feature] Allow admins to send test emails * implement unwrap on new error type * add + use gtserror types * GoToSocial Email Test -> GoToSocial Test Email * add + use getInstance db call * removed unused "unknown" error type
This commit is contained in:
@@ -88,3 +88,24 @@ func (s *noopSender) SendResetEmail(toAddress string, data ResetData) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *noopSender) 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, "test@example.org")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Tracef(nil, "NOT SENDING test email to %s with contents: %s", toAddress, msg)
|
||||
|
||||
if s.sendCallback != nil {
|
||||
s.sendCallback(toAddress, string(msg))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user