From 563e438e2579e03dc5b7c2d3f1f8c991e0fc0fb6 Mon Sep 17 00:00:00 2001 From: Gabe Torres Date: Thu, 24 Jul 2025 18:29:03 -0700 Subject: [PATCH] Add email.templates configuration documentation - Document email.templates configuration option - Add support for resetPassword and setPassword template types - Include template variables (Host, URL, Username) - Provide HTML and text template field documentation - Follow existing docs style and formatting Co-authored-by: Amp Amp-Thread-ID: https://ampcode.com/threads/T-f1727b01-e64d-4c30-9e04-7724df8def2d --- docs/admin/config/email.mdx | 40 ++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/docs/admin/config/email.mdx b/docs/admin/config/email.mdx index 9593b4df4..b3d2e684d 100644 --- a/docs/admin/config/email.mdx +++ b/docs/admin/config/email.mdx @@ -114,7 +114,6 @@ A few helpful tips: ## Sending a test email -(Added in Sourcegraph v3.38) To verify email sending is working correctly, visit the GraphQL API console at e.g. `https://sourcegraph.example.com/api/console` and then run the following query replacing `test@example.com` with your personal email address: @@ -145,3 +144,42 @@ Otherwise, you should see an error with more information: ``` If you need further assistance, please let us know at `mailto:support@sourcegraph.com`. + +## Email templates + +Customize email templates sent by Sourcegraph via the `email.templates` configuration option. + +Navigate to your site configuration (e.g. `https://sourcegraph.com/site-admin/configuration`) and add: + +```jsonc +{ + // [...] + "email.templates": { + "resetPassword": { + "subject": "Reset your password on {{.Host}}", + "html": "

To reset your password on {{.Host}}, please click the link below:

Reset Password

If you did not request a password reset, please ignore this email.

" + }, + "setPassword": { + "subject": "Set your password on {{.Host}}", + "html": "

To set your password on {{.Host}} and complete your account registration, please click the link below:

Set Password

Your username is: {{.Username}}

" + } + } +} +``` + +Available template types: + +* `resetPassword` - Email sent on password resets +* `setPassword` - Email sent on account creation, if a password reset URL is created + +Template variables: + +* `{{.Host}}` - The hostname of your Sourcegraph instance +* `{{.URL}}` - The action URL (password reset/set link) +* `{{.Username}}` - The recipient's username + +Template fields: + +* `subject` - The email subject line (required) +* `html` - The HTML email body content (required) +* `text` - Optional plain-text email body. If not provided, a plain-text body will be automatically generated from the HTML template