mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-19 11:34:59 +03:00
fix(email): build an RFC 5322 message with a proper From address and name (#5941)
The notification/test email carried only From/To/Subject/MIME headers, and
the From header was the raw SMTP username. Two problems:
- When the SMTP login is not a bare email address (common with relays and
submission services), the From header has no valid address and strict
receivers reject the message — e.g. Gmail returns "550-5.7.1 ... Messages
missing a valid address in From: header".
- There was no Date (mandatory per RFC 5322 section 3.6) and no Message-ID,
which also raises spam score.
Add smtpFrom (sender address) and smtpFromName (display name) settings and
assemble the message with net/mail: a name-addr From ("Name" <addr>), a
Date, a Message-ID, and an RFC 2047 encoded Subject, in a deterministic
header order. From falls back to the username when smtpFrom is empty, so
existing setups keep working. Wire the settings through the model, the SMTP
send and test paths, the Email settings UI, and all 13 locale files;
regenerate the Zod/OpenAPI artifacts.
Validate smtpFrom in AllSetting.CheckValid (reject anything net/mail cannot
parse), which surfaces a bad address at configuration time and prevents CRLF
header injection; strip CR/LF in buildMessage as defense in depth. Add
buildMessage and CheckValid tests.
This commit is contained in:
committed by
GitHub
parent
ae0da4c51f
commit
1cfd7b49b0
@@ -1358,6 +1358,10 @@
|
||||
"smtpPortDesc": "SMTPサーバーのポート(既定値: 587)",
|
||||
"smtpUsername": "SMTPユーザー名",
|
||||
"smtpUsernameDesc": "SMTP認証用のユーザー名",
|
||||
"smtpFrom": "送信元アドレス (From)",
|
||||
"smtpFromDesc": "メールの From ヘッダーに使用するアドレス。空欄の場合はユーザー名を使用します。",
|
||||
"smtpFromName": "送信者名 (From)",
|
||||
"smtpFromNameDesc": "From ヘッダーでアドレスの前に表示される任意の表示名。",
|
||||
"smtpPassword": "SMTPパスワード",
|
||||
"smtpPasswordDesc": "SMTP認証用のパスワード",
|
||||
"smtpTo": "受信者",
|
||||
|
||||
Reference in New Issue
Block a user