From a276b1ca06ce3ebfc201b9aaf3aa8c37c98fe584 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Mon, 27 May 2024 19:03:54 +0200 Subject: [feature/frontend] Let admins send test email to validate SMTP config (#2934) * [feature/frontend] Let admins send test email to validate SMTP config * wee --- internal/processing/admin/email.go | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'internal/processing/admin/email.go') diff --git a/internal/processing/admin/email.go b/internal/processing/admin/email.go index fb78f1fcc..fda60754c 100644 --- a/internal/processing/admin/email.go +++ b/internal/processing/admin/email.go @@ -27,11 +27,19 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" ) -// EmailTest sends a generic test email to the given toAddress (which -// should be a valid email address). To help callers differentiate between -// proper errors and the smtp errors they're likely fishing for, will return -// 422 + help text on an SMTP error, or error 500 otherwise. -func (p *Processor) EmailTest(ctx context.Context, account *gtsmodel.Account, toAddress string) gtserror.WithCode { +// EmailTest sends a generic test email to the given +// toAddress (which should be a valid email address). +// Message is optional and can be an empty string. +// +// To help callers differentiate between proper errors +// and the smtp errors they're likely fishing for, will +// return 422 + help text on an SMTP error, or 500 otherwise. +func (p *Processor) EmailTest( + ctx context.Context, + account *gtsmodel.Account, + toAddress string, + message string, +) gtserror.WithCode { // Pull our instance entry from the database, // so we can greet the email recipient nicely. instance, err := p.state.DB.GetInstance(ctx, config.GetHost()) @@ -42,6 +50,7 @@ func (p *Processor) EmailTest(ctx context.Context, account *gtsmodel.Account, to testData := email.TestData{ SendingUsername: account.Username, + Message: message, InstanceURL: instance.URI, InstanceName: instance.Title, } -- cgit v1.2.3