Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

feat: change invitation and password reset emails (#10297)

Pandeydf72c897f91e
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index cbdf760b2e..61e483c95d 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -43,6 +43,12 @@
/pkg/analytics/ @vikrantgupta25
/pkg/statsreporter/ @vikrantgupta25
+# Emailing Owners
+
+/pkg/emailing/ @vikrantgupta25
+/pkg/types/emailtypes/ @vikrantgupta25
+/templates/email/ @vikrantgupta25
+
# Querier Owners
/pkg/querier/ @srikanthccv
diff --git a/.vscode/settings.json b/.vscode/settings.json
index da2f53cf89..1720c91e72 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -14,5 +14,8 @@
},
"[sql]": {
"editor.defaultFormatter": "adpyke.vscode-sql-formatter"
+ },
+ "[html]": {
+ "editor.defaultFormatter": "vscode.html-language-features"
}
}
diff --git a/conf/example.yaml b/conf/example.yaml
index bf37e03698..4a16685626 100644
--- a/conf/example.yaml
+++ b/conf/example.yaml
@@ -193,6 +193,15 @@ emailing:
templates:
# The directory containing the email templates. This directory should contain a list of files defined at pkg/types/emailtypes/template.go.
directory: /opt/signoz/conf/templates/email
+ format:
+ header:
+ enabled: false
+ logo_url: ""
+ help:
+ enabled: false
+ email: ""
+ footer:
+ enabled: false
smtp:
# The SMTP server address.
address: localhost:25
diff --git a/pkg/emailing/config.go b/pkg/emailing/config.go
index e40e2bd464..8407525361 100644
--- a/pkg/emailing/config.go
+++ b/pkg/emailing/config.go
@@ -10,6 +10,27 @@ type Config struct {
type Templates struct {
Directory string `mapstructure:"directory"`
+ Format Format `mapstructure:"format"`
+}
+
+type Format struct {
+ Header Header `mapstructure:"header"`
+ Help Help `mapstructure:"help"`
+ Footer Footer `mapstructure:"footer"`
+}
+
+type Header struct {
+ Enabled bool `mapstructure:"enabled"`
+ LogoURL string `mapstructure:"logo_url"`
+}
+
+type Help struct {
+ Enabled bool `mapstructure:"enabled"`
+ Email string `mapstructure:"email"`
+}
+
+type Footer struct {
+ Enabled bool `mapstructure:"enabled"`
}
type SMTP struct {
@@ -45,6 +66,19 @@ func newConfig() factory.Config {
Enabled: false,
Templates: Templates{
Directory: "/root/templates",
+ Format: Format{
+ Header: Header{
+ Enabled: false,
+ LogoURL: "",
+ },
+ Help: Help{
+ Enabled: false,
+ Email: "",
+ },
+ Footer: Footer{
+ Enabled: false,
+ },
+ },
},
SMTP: SMTP{
Address: "localhost:25",
diff --git a/pkg/emailing/smtpemailing/provider.go b/pkg/emailing/smtpemailing/provider.go
index 07eb0c6100..07afacecf3 100644
--- a/pkg/emailing/smtpemailing/provider.go
+++ b/pkg/emailing/smtpemailing/provider.go
@@ -15,6 +15,7 @@ type provider struct {
settings factory.ScopedProviderSettings
store emailtypes.TemplateStore
client *client.Client
+ config emailing.Config
}
func NewFactory() factory.ProviderFactory[emailing.Emailing, emailing.Config] {
@@ -55,7 +56,12 @@ func New(ctx context.Context, providerSettings factory.ProviderSettings, config
return nil, err
}
- return &provider{settings: settings, store: store, client: client}, nil
+ return &provider{
+ settings: settings,
+ store: store,
+ client: client,
+ config: config,
+ }, nil
}
func (provider *provider) SendHTML(ctx context.Context, to string, subject string, templateName emailtypes.TemplateName, data map[string]any) error {
@@ -69,8 +75,19 @@ func (provider *provider) SendHTML(ctx context.Context, to string, subject strin
return err
}
+ // if no data is provided, create an empty map to prevent a panic when we add the format, to, and subject data
+ if data == nil {
+ data = make(map[string]any)
+ }
+
+ // the following are overridden if provided in the data map
+ data["format"] = provider.config.Templates.Format
+ data["to"] = to
+ data["subject"] = subject
+
content, err := emailtypes.NewContent(template, data)
if err != nil {
+ provider.settings.Logger().ErrorContext(ctx, "failed to create email content", "error", err)
return err
}
diff --git a/pkg/modules/user/impluser/module.go b/pkg/modules/user/impluser/module.go
index 746bb46a99..f0b13db54c 100644
--- a/pkg/modules/user/impluser/module.go
+++ b/pkg/modules/user/impluser/module.go
@@ -22,8 +22,6 @@ import (
"github.com/SigNoz/signoz/pkg/types/roletypes"
"github.com/SigNoz/signoz/pkg/valuer"
"github.com/dustin/go-humanize"
- "golang.org/x/text/cases"
- "golang.org/x/text/language"
)
type Module struct {
@@ -146,11 +144,9 @@ func (m *Module) CreateBulkInvite(ctx context.Context, orgID valuer.UUID, userID
continue
}
- if err := m.emailing.SendHTML(ctx, invites[i].Email.String(), "You are invited to join a team in SigNoz", emailtypes.TemplateNameInvitationEmail, map[string]any{
- "CustomerName": invites[i].Name,
- "InviterName": creator.DisplayName,
- "InviterEmail": creator.Email,
- "Link": fmt.Sprintf("%s/signup?token=%s", bulkInvites.Invites[i].FrontendBaseUrl, invites[i].Token),
+ if err := m.emailing.SendHTML(ctx, invites[i].Email.String(), "You're Invited to Join SigNoz", emailtypes.TemplateNameInvitationEmail, map[string]any{
+ "inviter_email": creator.Email,
+ "link": fmt.Sprintf("%s/signup?token=%s", bulkInvites.Invites[i].FrontendBaseUrl, invites[i].Token),
}); err != nil {
m.settings.Logger().ErrorContext(ctx, "failed to send email", "error", err)
}
@@ -261,18 +257,6 @@ func (m *Module) UpdateUser(ctx context.Context, orgID valuer.UUID, id string, u
traits["updated_by"] = updatedBy
m.analytics.TrackUser(ctx, user.OrgID.String(), user.ID.String(), "User Updated", traits)
- // if the role is updated then send an email
- if existingUser.Role != updatedUser.Role {
- if err := m.emailing.SendHTML(ctx, existingUser.Email.String(), "Your Role Has Been Updated in SigNoz", emailtypes.TemplateNameUpdateRole, map[string]any{
- "CustomerName": existingUser.DisplayName,
- "UpdatedByEmail": requestor.Email,
- "OldRole": cases.Title(language.English).String(strings.ToLower(existingUser.Role.String())),
- "NewRole": cases.Title(language.English).String(strings.ToLower(updatedUser.Role.String())),
- }); err != nil {
- m.settings.Logger().ErrorContext(ctx, "failed to send email", "error", err)
- }
- }
-
if err := m.tokenizer.DeleteIdentity(ctx, valuer.MustNewUUID(id)); err != nil {
return nil, err
}
@@ -394,10 +378,9 @@ func (module *Module) ForgotPassword(ctx context.Context, orgID valuer.UUID, ema
if err := module.emailing.SendHTML(
ctx,
user.Email.String(),
- "Reset your SigNoz password",
+ "A Password Reset Was Requested for SigNoz",
emailtypes.TemplateNameResetPassword,
map[string]any{
- "Name": user.DisplayName,
"Link": resetLink,
"Expiry": humanizedTokenLifetime,
},
diff --git a/pkg/types/emailtypes/template.go b/pkg/types/emailtypes/template.go
index 942bf07d72..f13905faa0 100644
--- a/pkg/types/emailtypes/template.go
+++ b/pkg/types/emailtypes/template.go
@@ -12,13 +12,12 @@ import (
var (
// Templates is a list of all the templates that are supported by the emailing service.
// This list should be updated whenever a new template is added.
- Templates = []TemplateName{TemplateNameInvitationEmail, TemplateNameUpdateRole, TemplateNameResetPassword}
+ Templates = []TemplateName{TemplateNameInvitationEmail, TemplateNameResetPassword}
)
var (
- TemplateNameInvitationEmail = TemplateName{valuer.NewString("invitation_email")}
- TemplateNameUpdateRole = TemplateName{valuer.NewString("update_role")}
- TemplateNameResetPassword = TemplateName{valuer.NewString("reset_password_email")}
+ TemplateNameInvitationEmail = TemplateName{valuer.NewString("invitation")}
+ TemplateNameResetPassword = TemplateName{valuer.NewString("reset_password")}
)
type TemplateName struct{ valuer.String }
@@ -27,8 +26,6 @@ func NewTemplateName(name string) (TemplateName, error) {
switch name {
case TemplateNameInvitationEmail.StringValue():
return TemplateNameInvitationEmail, nil
- case TemplateNameUpdateRole.StringValue():
- return TemplateNameUpdateRole, nil
case TemplateNameResetPassword.StringValue():
return TemplateNameResetPassword, nil
default:
@@ -40,7 +37,7 @@ func NewContent(template *template.Template, data map[string]any) ([]byte, error
buf := bytes.NewBuffer(nil)
err := template.Execute(buf, data)
if err != nil {
- return nil, errors.WrapInternalf(err, errors.CodeInternal, "failed to execute template")
+ return nil, err
}
return buf.Bytes(), nil
diff --git a/templates/email/invitation.gotmpl b/templates/email/invitation.gotmpl
new file mode 100644
index 0000000000..b6582be290
--- /dev/null
+++ b/templates/email/invitation.gotmpl
@@ -0,0 +1,91 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <title>You're Invited to Join SigNoz</title>
+</head>
+
+<body style="margin:0;padding:0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif;line-height:1.6;color:#333;background:#fff">
+ <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="background:#fff">
+ <tr>
+ <td align="center" style="padding:0">
+ <table role="presentation" width="600" cellspacing="0" cellpadding="0" border="0" style="max-width:600px;width:100%">
+ {{ if .format.Header.Enabled }}
+ <tr>
+ <td align="center" style="padding:16px 20px 16px">
+ <img src="{{.format.Header.LogoURL}}" alt="SigNoz" width="160" height="40" style="display:block;border:0;outline:none;max-width:100%;height:auto">
+ </td>
+ </tr>
+ {{ end }}
+ <tr>
+ <td style="padding:16px 20px 16px">
+ <p style="margin:0 0 16px;font-size:16px;color:#333">
+ Hi there,
+ </p>
+ <p style="margin:0 0 16px;font-size:16px;color:#333;line-height:1.6">
+ You've been invited by <strong>{{.inviter_email}}</strong> to join their SigNoz organization.
+ </p>
+ <p style="margin:0 0 12px;font-size:16px;color:#333;line-height:1.6">
+ A new account has been created for you with the following details:
+ </p>
+ <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="margin:0 0 16px">
+ <tr>
+ <td style="padding:20px;background:#f5f5f5;border-radius:6px;border-left:4px solid #4E74F8">
+ <p style="margin:0;font-size:15px;color:#333;line-height:1.6">
+ <strong>Email:</strong> {{.to}}
+ </p>
+ </td>
+ </tr>
+ </table>
+ <p style="margin:0 0 16px;font-size:16px;color:#333;line-height:1.6">
+ Accept the invitation to get started.
+ </p>
+ <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="margin:0 0 16px">
+ <tr>
+ <td align="center">
+ <a href="{{.link}}" target="_blank" style="display:inline-block;padding:16px 48px;font-size:16px;font-weight:600;color:#fff;background:#4E74F8;text-decoration:none;border-radius:4px">
+ Accept Invitation
+ </a>
+ </td>
+ </tr>
+ </table>
+ <p style="margin:0 0 4px;font-size:13px;color:#666;text-align:center">
+ Button not working? Copy and paste this link into your browser:
+ </p>
+ <p style="margin:0 0 16px;font-size:13px;color:#4E74F8;word-break:break-all;text-align:center">
+ <a href="{{.link}}" style="color:#4E74F8;text-decoration:none">
+ {{.link}}
+ </a>
+ </p>
+ {{ if .format.Help.Enabled }}
+ <p style="margin:0 0 16px;font-size:16px;color:#333;line-height:1.6">
+ Need help? Chat with our team in the SigNoz application or email us at <a href="mailto:{{.format.Help.Email}}" style="color:#4E74F8;text-decoration:none">{{.format.Help.Email}}</a>.
+ </p>
+ {{ end }}
+ <p style="margin:0;font-size:16px;color:#333;line-height:1.6">
+ Thanks,<br><strong>The SigNoz Team</strong>
+ </p>
+ </td>
+ </tr>
+ {{ if .format.Footer.Enabled }}
+ <tr>
+ <td align="center" style="padding:8px 16px 8px">
+ <p style="margin:0 0 8px;font-size:12px;color:#999;line-height:1.5">
+ <a href="https://signoz.io/terms-of-service/" style="color:#4E74F8;text-decoration:none">Terms of Service</a> - <a href="https://signoz.io/privacy/" style="color:#4E74F8;text-decoration:none">Privacy Policy</a>
+ </p>
+ <p style="margin:0;font-size:12px;color:#999;line-height:1.5">
+ &#169; 2026 SigNoz Inc.
+ </p>
+ </td>
+ </tr>
+ {{ end }}
+ </table>
+ </td>
+ </tr>
+ </table>
+</body>
+
+</html>
\ No newline at end of file
diff --git a/templates/email/invitation_email.gotmpl b/templates/email/invitation_email.gotmpl
deleted file mode 100644
index 75fa3a32e8..0000000000
--- a/templates/email/invitation_email.gotmpl
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE html>
-<html>
-<body>
- <p>Hi {{.CustomerName}},</p>
- <p>You have been invited to join SigNoz project by {{.InviterName}} ({{.InviterEmail}}).</p>
- <p>Please click on the following button to accept the invitation:</p>
- <a href="{{.Link}}" style="background-color: #000000; color: white; padding: 14px 20px; text-align: center; text-decoration: none; display: inline-block;">Accept Invitation</a>
- <p>Button not working? Paste the following link into your browser:</p>
- <p>{{.Link}}</p>
- <p>Follow docs here 👉 to <a href="https://signoz.io/docs/cloud/">Get Started with SigNoz Cloud</a></p>
- <p>Thanks,</p>
- <p>SigNoz Team</p>
-</body>
-</html>
diff --git a/templates/email/reset_password.gotmpl b/templates/email/reset_password.gotmpl
new file mode 100644
index 0000000000..eb25255dea
--- /dev/null
+++ b/templates/email/reset_password.gotmpl
@@ -0,0 +1,91 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <title>{{.subject}}</title>
+</head>
+
+<body style="margin:0;padding:0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif;line-height:1.6;color:#333;background:#fff">
+ <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="background:#fff">
+ <tr>
+ <td align="center" style="padding:0">
+ <table role="presentation" width="600" cellspacing="0" cellpadding="0" border="0" style="max-width:600px;width:100%">
+ {{ if .format.Header.Enabled }}
+ <tr>
+ <td align="center" style="padding:16px 20px 16px">
+ <img src="{{.format.Header.LogoURL}}" alt="SigNoz" width="160" height="40" style="display:block;border:0;outline:none;max-width:100%;height:auto">
+ </td>
+ </tr>
+ {{ end }}
+ <tr>
+ <td style="padding:16px 20px 16px">
+ <p style="margin:0 0 16px;font-size:16px;color:#333">
+ Hi there,
+ </p>
+ <p style="margin:0 0 16px;font-size:16px;color:#333;line-height:1.6">
+ A password reset was requested for your SigNoz account.
+ </p>
+ <p style="margin:0 0 16px;font-size:16px;color:#333;line-height:1.6">
+ Click the button below to reset your password:
+ </p>
+ <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="margin:0 0 16px">
+ <tr>
+ <td align="center">
+ <a href="{{.Link}}" target="_blank" style="display:inline-block;padding:16px 48px;font-size:16px;font-weight:600;color:#fff;background:#4E74F8;text-decoration:none;border-radius:4px">
+ Reset Password
+ </a>
+ </td>
+ </tr>
+ </table>
+ <p style="margin:0 0 4px;font-size:13px;color:#666;text-align:center">
+ Button not working? Copy and paste this link into your browser:
+ </p>
+ <p style="margin:0 0 16px;font-size:13px;color:#4E74F8;word-break:break-all;text-align:center">
+ <a href="{{.Link}}" style="color:#4E74F8;text-decoration:none">
+ {{.Link}}
+ </a>
+ </p>
+ <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="margin:0 0 16px">
+ <tr>
+ <td style="padding:16px;background:#fff4e6;border-radius:6px;border-left:4px solid #ff9800">
+ <p style="margin:0;font-size:14px;color:#333;line-height:1.6">
+ <strong>⏱️ This link will expire in {{.Expiry}}.</strong>
+ </p>
+ </td>
+ </tr>
+ </table>
+ <p style="margin:0 0 16px;font-size:16px;color:#333;line-height:1.6">
+ If you didn't request this password reset, please ignore this email. Your password will remain unchanged.
+ </p>
+ {{ if .format.Help.Enabled }}
+ <p style="margin:0 0 16px;font-size:16px;color:#333;line-height:1.6">
+ Need help? Chat with our team in the SigNoz application or email us at <a href="mailto:{{.format.Help.Email}}" style="color:#4E74F8;text-decoration:none">{{.format.Help.Email}}</a>.
+ </p>
+ {{ end }}
+ <p style="margin:0;font-size:16px;color:#333;line-height:1.6">
+ Thanks,<br><strong>The SigNoz Team</strong>
+ </p>
+ </td>
+ </tr>
+ {{ if .format.Footer.Enabled }}
+ <tr>
+ <td align="center" style="padding:8px 16px 8px">
+ <p style="margin:0 0 8px;font-size:12px;color:#999;line-height:1.5">
+ <a href="https://signoz.io/terms-of-service/" style="color:#4E74F8;text-decoration:none">Terms of Service</a> - <a href="https://signoz.io/privacy/" style="color:#4E74F8;text-decoration:none">Privacy Policy</a>
+ </p>
+ <p style="margin:0;font-size:12px;color:#999;line-height:1.5">
+ &#169; 2026 SigNoz Inc.
+ </p>
+ </td>
+ </tr>
+ {{ end }}
+ </table>
+ </td>
+ </tr>
+ </table>
+</body>
+
+</html>
\ No newline at end of file
diff --git a/templates/email/reset_password_email.gotmpl b/templates/email/reset_password_email.gotmpl
deleted file mode 100644
index cdaaeceab8..0000000000
--- a/templates/email/reset_password_email.gotmpl
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html>
-<html>
-<body>
- <p>Hello {{.Name}},</p>
- <p>You requested a password reset for your SigNoz account.</p>
- <p>Click the link below to reset your password:</p>
- <a href="{{.Link}}">Reset Password</a>
- <p>This link will expire in {{.Expiry}}.</p>
- <p>If you didn't request this, please ignore this email. Your password will remain unchanged.</p>
- <br>
- <p>Best regards,<br>The SigNoz Team</p>
-</body>
-</html>
diff --git a/templates/email/update_role.gotmpl b/templates/email/update_role.gotmpl
deleted file mode 100644
index 0bfd5fecb8..0000000000
--- a/templates/email/update_role.gotmpl
+++ /dev/null
@@ -1,21 +0,0 @@
-<!DOCTYPE html>
-<html>
-<body>
- Hi {{.CustomerName}},<br>
- Your role in <strong>SigNoz</strong> has been updated by {{.UpdatedByEmail}}.
- <p>
- <strong>Previous Role:</strong> {{.OldRole}}<br>
- <strong>New Role:</strong> {{.NewRole}}
- </p>
- {{if eq .OldRole "Admin"}}
- <p>
- If you were not expecting this change or have any questions, please contact us at <a href="mailto:[email protected]">[email protected]</a>.
- </p>
- {{else}}
- <p>
- If you were not expecting this change or have any questions, please reach out to your administrator.
- </p>
- {{end}}
- <p>Best regards,<br>The SigNoz Team</p>
-</body>
-</html>
\ No newline at end of file