mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #5941] [MERGED] fix(email): build an RFC 5322 message with a proper From address #6033
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6033
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/5941
Author: @yukh975
Created: 7/13/2026
Status: ✅ Merged
Merged: 7/14/2026
Merged by: @MHSanaei
Base:
main← Head:fix/smtp-from-header📝 Commits (1)
d878716fix(email): build an RFC 5322 message with a proper From address and name📊 Changes
25 files changed (+293 additions, -15 deletions)
View changed files
📝
frontend/public/openapi.json(+16 -0)📝
frontend/src/generated/examples.ts(+4 -0)📝
frontend/src/generated/schemas.ts(+16 -0)📝
frontend/src/generated/types.ts(+4 -0)📝
frontend/src/generated/zod.ts(+4 -0)📝
frontend/src/models/setting.ts(+2 -0)📝
frontend/src/pages/settings/EmailTab.tsx(+10 -0)➕
internal/web/entity/check_valid_test.go(+29 -0)📝
internal/web/entity/entity.go(+9 -0)📝
internal/web/service/email/email.go(+48 -15)➕
internal/web/service/email/email_test.go(+81 -0)📝
internal/web/service/setting.go(+18 -0)📝
internal/web/translation/ar-EG.json(+4 -0)📝
internal/web/translation/en-US.json(+4 -0)📝
internal/web/translation/es-ES.json(+4 -0)📝
internal/web/translation/fa-IR.json(+4 -0)📝
internal/web/translation/id-ID.json(+4 -0)📝
internal/web/translation/ja-JP.json(+4 -0)📝
internal/web/translation/pt-BR.json(+4 -0)📝
internal/web/translation/ru-RU.json(+4 -0)...and 5 more files
📄 Description
Problem
Sending a notification or test email from the panel can be rejected by strict receivers. With Gmail the server returns:
Root cause
buildMessageset theFrom:header to the raw SMTP username and emitted onlyFrom/To/Subject/MIME-Version/Content-Type:From:carries no valid address and the message is rejected.Date:(mandatory per RFC 5322 §3.6) and noMessage-ID:, both of which also raise the spam score (e.g. SpamAssassinMISSING_DATE/MISSING_MID).Fix
smtpFrom(sender address) andsmtpFromName(optional display name).Fromfalls back to the username whensmtpFromis empty, so existing setups are unchanged.net/mail: a proper name-addrFrom("Name" <addr>), aDate, aMessage-ID, and an RFC 2047 encodedSubject, in a deterministic header order.Resulting message:
Changes
smtpFrom/smtpFromNamesettings (model, defaults, getters), SMTP send + test paths,buildMessagerewrite.make gen).buildMessageunit tests (message parsed back withnet/mail).Compatibility
Backward compatible — with
smtpFromempty theFromaddress is still the username, as before (now correctly formatted as aname-addr).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.