[PR #2536] [MERGED] fix(mail): set RFC 5322 compliant Message-ID using public URL domain #8346

Closed
opened 2026-04-20 18:09:53 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/2536
Author: @tink-bot
Created: 4/3/2026
Status: Merged
Merged: 4/3/2026
Merged by: @kolaente

Base: mainHead: fix-smtp-message-id


📝 Commits (6)

  • c1102e7 feat(mail): add GetMailDomain helper for RFC 5322 compliant email IDs
  • 1f10493 fix(mail): set RFC 5322 compliant Message-ID using public URL domain
  • 45236b6 refactor(models): use shared GetMailDomain in getThreadID
  • d3a6e34 fix(mail): fall back to os.Hostname() before hardcoded domain
  • 22fdaab refactor(mail): use CryptoRandomString for Message-ID generation
  • 72ef092 fix(mail): guard log calls in GetMailDomain and fix hostname-dependent tests

📊 Changes

7 files changed (+171 additions, -11 deletions)

View changed files

📝 pkg/log/logging.go (+5 -0)
pkg/mail/domain.go (+47 -0)
pkg/mail/domain_test.go (+57 -0)
📝 pkg/mail/send_mail.go (+7 -0)
pkg/mail/send_mail_test.go (+42 -0)
📝 pkg/models/notifications.go (+2 -9)
📝 pkg/models/notifications_test.go (+11 -2)

📄 Description

Outgoing emails now set an explicit Message-ID header using the hostname from the configured public URL, instead of relying on go-mail's default which calls os.Hostname() -- unreliable in Docker/Kubernetes where it returns the container ID.

Fixes #2522

Also extracts the domain-from-URL logic into a shared GetMailDomain() helper and refactors getThreadID() to reuse it.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-vikunja/vikunja/pull/2536 **Author:** [@tink-bot](https://github.com/tink-bot) **Created:** 4/3/2026 **Status:** ✅ Merged **Merged:** 4/3/2026 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `fix-smtp-message-id` --- ### 📝 Commits (6) - [`c1102e7`](https://github.com/go-vikunja/vikunja/commit/c1102e75dcb001e824f6d9b419bcbe0594d9c3e7) feat(mail): add GetMailDomain helper for RFC 5322 compliant email IDs - [`1f10493`](https://github.com/go-vikunja/vikunja/commit/1f10493ed92e09df6fae3a0e1ae928be199d01c5) fix(mail): set RFC 5322 compliant Message-ID using public URL domain - [`45236b6`](https://github.com/go-vikunja/vikunja/commit/45236b610df4a2fa41dcf42c464ca04a8caae638) refactor(models): use shared GetMailDomain in getThreadID - [`d3a6e34`](https://github.com/go-vikunja/vikunja/commit/d3a6e34af15a9f108792dc7e6b26760ca9b6a061) fix(mail): fall back to os.Hostname() before hardcoded domain - [`22fdaab`](https://github.com/go-vikunja/vikunja/commit/22fdaab275b448de4181396ca7524062bc121373) refactor(mail): use CryptoRandomString for Message-ID generation - [`72ef092`](https://github.com/go-vikunja/vikunja/commit/72ef092c7786db5b08ced954cdded54df8c114e6) fix(mail): guard log calls in GetMailDomain and fix hostname-dependent tests ### 📊 Changes **7 files changed** (+171 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `pkg/log/logging.go` (+5 -0) ➕ `pkg/mail/domain.go` (+47 -0) ➕ `pkg/mail/domain_test.go` (+57 -0) 📝 `pkg/mail/send_mail.go` (+7 -0) ➕ `pkg/mail/send_mail_test.go` (+42 -0) 📝 `pkg/models/notifications.go` (+2 -9) 📝 `pkg/models/notifications_test.go` (+11 -2) </details> ### 📄 Description Outgoing emails now set an explicit Message-ID header using the hostname from the configured public URL, instead of relying on go-mail's default which calls `os.Hostname()` -- unreliable in Docker/Kubernetes where it returns the container ID. Fixes #2522 Also extracts the domain-from-URL logic into a shared `GetMailDomain()` helper and refactors `getThreadID()` to reuse it. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-20 18:09:53 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#8346