Smail/server/controllers
Cd1s 23c2fbbdd5
fix: generate Message-ID once and persist to DB (#328)
Previously, a random suffix was generated every time BuildBytes or
ForwardBuildBytes was called, causing IMAP/POP3 clients to treat the
same message as a new message on every sync and breaking conversation
threading.

Changes:
- Add msg_id column to the email table (synced automatically via Sync2)
- Generate a crypto/rand-based RFC-compliant Message-ID once at email
  creation time (send.go for outgoing, read_content.go for incoming)
- Preserve the original Message-ID from externally received emails
- Load the persisted MsgID when rebuilding Email from DB records
- Use the stored MsgID in BuildBytes, ForwardBuildBytes and the IMAP
  ENVELOPE response; fall back to the old numeric format for legacy rows

Fixes the MSGID_SHORT SpamAssassin penalty and Gmail rejection while
keeping Message-IDs stable across syncs.

Co-authored-by: root <root@Claw-ai.tail1478c.ts.net>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 11:43:59 +08:00
..
email fix: generate Message-ID once and persist to DB (#328) 2026-04-13 11:43:59 +08:00
attachments.go v2.6.1 (#169) 2024-07-20 10:39:17 +08:00
base.go v2.6.1 (#169) 2024-07-20 10:39:17 +08:00
group.go Feature/v2.8.9 (#315) 2025-11-23 17:56:07 +08:00
interceptor.go v2.6.1 (#169) 2024-07-20 10:39:17 +08:00
login.go v2.6.1 (#169) 2024-07-20 10:39:17 +08:00
ping.go v2.6.1 (#169) 2024-07-20 10:39:17 +08:00
plugin.go v2.6.2 (#177) 2024-07-27 20:47:42 +08:00
rule.go v2.6.1 (#169) 2024-07-20 10:39:17 +08:00
settings.go Feature/v2.8.10 (#323) 2026-02-01 16:40:24 +08:00
setup.go v2.6.1 (#169) 2024-07-20 10:39:17 +08:00
user.go v2.6.1 (#169) 2024-07-20 10:39:17 +08:00