Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[server] Make SMTP sender name configurable

Tobias Genanntae6899806943
diff --git a/server/configurations/local.yaml b/server/configurations/local.yaml
index cd061cfd06..8774a2ae7b 100644
--- a/server/configurations/local.yaml
+++ b/server/configurations/local.yaml
@@ -228,6 +228,9 @@ smtp:
# The email address from which to send the email. Set this to an email
# address whose credentials you're providing.
email:
+ # Optional override for the sender name in the emails. If specified, it will
+ # be used for all emails sent by the instance (default is email specific).
+ sender-name:
# Zoho Zeptomail config (optional)
#
diff --git a/server/pkg/utils/email/email.go b/server/pkg/utils/email/email.go
index ca90fd48b4..6565f3774a 100644
--- a/server/pkg/utils/email/email.go
+++ b/server/pkg/utils/email/email.go
@@ -46,6 +46,7 @@ func sendViaSMTP(toEmails []string, fromName string, fromEmail string, subject s
smtpUsername := viper.GetString("smtp.username")
smtpPassword := viper.GetString("smtp.password")
smtpEmail := viper.GetString("smtp.email")
+ smtpSenderName := viper.GetString("smtp.sender-name")
var emailMessage string
var auth smtp.Auth = nil
@@ -62,10 +63,14 @@ func sendViaSMTP(toEmails []string, fromName string, fromEmail string, subject s
emailAddresses += email
}
- // If an sender email is provided use it instead of the fromEmail.
+ // If a sender email is provided use it instead of the fromEmail.
if smtpEmail != "" {
fromEmail = smtpEmail
}
+ // If a sender name is provided use it instead of the fromName.
+ if smtpSenderName != "" {
+ fromName = smtpSenderName
+ }
header := "From: " + fromName + " <" + fromEmail + ">\n" +
"To: " + emailAddresses + "\n" +