Skip to content

PostgreSQL backup tool with Point-In-Time-Recovery and restore verification

REFACTOR (email): Refactor commit adding date headers to emails

Rostislav Dugin744e51d1e199
diff --git a/backend/internal/features/email/email.go b/backend/internal/features/email/email.go
index 9691c9ae..72ca2ff0 100644
--- a/backend/internal/features/email/email.go
+++ b/backend/internal/features/email/email.go
@@ -52,10 +52,7 @@ func (s *EmailSMTPSender) buildEmailContent(to, subject, body, from string) []by
// Encode Subject header using RFC 2047 to avoid SMTPUTF8 requirement
encodedSubject := encodeRFC2047(subject)
subjectHeader := fmt.Sprintf("Subject: %s\r\n", encodedSubject)
- // Get the current time
- now := time.Now()
- // Generate Date header that is compliant with RFC 5322 using the format from RFC 1123Z
- dateHeader := fmt.Sprintf("Date: %s\r\n", now.Format(time.RFC1123Z))
+ dateHeader := fmt.Sprintf("Date: %s\r\n", time.Now().UTC().Format(time.RFC1123Z))
mimeHeaders := fmt.Sprintf(
"MIME-version: 1.0;\nContent-Type: %s; charset=\"%s\";\n\n",
diff --git a/backend/internal/features/notifiers/models/email_notifier/model.go b/backend/internal/features/notifiers/models/email_notifier/model.go
index c6eca038..5d0b2dc9 100644
--- a/backend/internal/features/notifiers/models/email_notifier/model.go
+++ b/backend/internal/features/notifiers/models/email_notifier/model.go
@@ -130,10 +130,7 @@ func (e *EmailNotifier) buildEmailContent(heading, message, from string) []byte
// This ensures compatibility with SMTP servers that don't support SMTPUTF8
encodedSubject := encodeRFC2047(heading)
subject := fmt.Sprintf("Subject: %s\r\n", encodedSubject)
- // Get the current time
- now := time.Now()
- // Generate Date header that is compliant with RFC 5322 using the format from RFC 1123Z
- dateHeader := fmt.Sprintf("Date: %s\r\n", now.Format(time.RFC1123Z))
+ dateHeader := fmt.Sprintf("Date: %s\r\n", time.Now().UTC().Format(time.RFC1123Z))
mimeHeaders := fmt.Sprintf(
"MIME-version: 1.0;\nContent-Type: %s; charset=\"%s\";\n\n",