diff options
author | 2024-05-27 19:03:54 +0200 | |
---|---|---|
committer | 2024-05-27 17:03:54 +0000 | |
commit | a276b1ca06ce3ebfc201b9aaf3aa8c37c98fe584 (patch) | |
tree | 861d2c9c7440fd6b602f46a3e18a55b4c31718d1 /internal/processing | |
parent | [experiment] add alternative wasm sqlite3 implementation available via build-... (diff) | |
download | gotosocial-a276b1ca06ce3ebfc201b9aaf3aa8c37c98fe584.tar.xz |
[feature/frontend] Let admins send test email to validate SMTP config (#2934)
* [feature/frontend] Let admins send test email to validate SMTP config
* wee
Diffstat (limited to 'internal/processing')
-rw-r--r-- | internal/processing/admin/email.go | 19 |
1 files changed, 14 insertions, 5 deletions
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, } |