From 4fe07630107e6653b9292f7b8da27a2e2a155cbe Mon Sep 17 00:00:00 2001 From: Weijie Zhao Date: Fri, 7 Nov 2025 18:44:24 +0800 Subject: [PATCH] fix: properly quote email sender names containing @ symbols (#1768) When user names contain @ symbols, the email library fails to parse the sender address format "Name @ Symbol via Vikunja ". This fix uses Go's net/mail.Address to properly format the sender address according to RFC 5322, which automatically quotes names containing special characters. Fixes the error: "getting sender address: no FROM address set" --- pkg/user/user.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/user/user.go b/pkg/user/user.go index f0252e634..1bcefa860 100644 --- a/pkg/user/user.go +++ b/pkg/user/user.go @@ -20,6 +20,7 @@ import ( "encoding/json" "errors" "fmt" + "net/mail" "reflect" "strconv" "time" @@ -175,7 +176,12 @@ func (u *User) GetName() string { // GetNameAndFromEmail returns the name and email address for a user. Useful to use in notifications. func (u *User) GetNameAndFromEmail() string { - return u.GetName() + " via Vikunja <" + config.MailerFromEmail.GetString() + ">" + // Use RFC 5322 compliant address formatting to properly handle special characters like @ in names + addr := mail.Address{ + Name: u.GetName() + " via Vikunja", + Address: config.MailerFromEmail.GetString(), + } + return addr.String() } func (u *User) GetFailedTOTPAttemptsKey() string {