mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6360] [Bug]: Enable smtp, but still prompt smtpHostNotConfiguring after filling in the host #4317
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#4317
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?
Originally created by @qjds on GitHub (Aug 29, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6360
Describe the bug
After correctly filling in the smtp host, whether clicking the send test email or save button, it will prompt smtpHostNotConfiguring, and whether filling in all or only the smtp host is the same
How to reproduce the problem
After correctly filling in the smtp host, click the save or send test email button
Expected behavior
No response
Actual behavior
No response
Relevant logs
Screenshots
No response
3x-ui version
3.7.0
Xray-core version
26.7.28
How did you install 3x-ui?
install.sh script
Operating system
ubuntu 26.04
Which parts of the panel are affected?
Backend (API endpoints, login, settings)
Browser (only if it is a UI bug)
edge 151.0.4129.107
Is the panel behind a reverse proxy or CDN?
Yes — Cloudflare (proxied DNS)
Before submitting
@NgaiYeanCoi commented on GitHub (Aug 29, 2026):
@github-actions[bot] commented on GitHub (Aug 29, 2026):
Short answer: "Send test email" tests the saved SMTP settings, not what is currently typed in the form. Typing the host into the field changes only the browser-side draft — the test request carries no body, so the backend still reads the empty
smtpHostrow from the settings table and returnssmtpHostNotConfigured. Click Save (the button in the header card at the top of Panel → Settings, it is enabled only while there are unsaved changes), then click Send test email.The request sends nothing:
and the handler reads the persisted value:
GetSmtpHost()is a plain DB read (internal/web/service/setting.go:1099-1101→getString("smtpHost")→internal/web/service/setting.go:346-358), with no cache in between. The Telegram test button (/panel/api/setting/testTgBot) works the same way.On the Save button showing the same message: it cannot.
/panel/api/setting/updatehas exactly one response string,pages.settings.toasts.modifySettings(internal/web/controller/setting.go:174); the textsmtpHostNotConfiguredexists in only one place in the whole backend, the line quoted above. What you are most likely seeing is the previous test's alert still on screen —testResultis cleared only when a new test starts (EmailTab.tsx:39) or when you close the alert yourself (EmailTab.tsx:207), so it survives a save.If it still fails after a successful save, please add:
x-ui log, look forSMTP test: starting...andSMTP test failed at ...(internal/web/controller/setting.go:296-299). The "Relevant logs" section of your report was empty.Also note the test needs more than the host: with
SMTP From/SMTP Usernameboth empty you will getsmtpFromNotConfigured, and withSMTP Toempty,smtpNoRecipients(internal/web/service/email/email.go:129-137).Verdict: Not a bug (user configuration)
Severity: N/A for the reported symptom (two unrelated defects found in the same code path are noted below, both Low)
Confidence: High on the mechanism; Medium that it fully explains this report, because I cannot verify the reporter's save succeeded
Root cause: No defect in the reported path.
EmailTab.handleTestSmtp(frontend/src/pages/settings/EmailTab.tsx:37-51) POSTs/panel/api/setting/testSmtpwith no body, andEmailService.TestConnection(internal/web/service/email/email.go:110-113) readssmtpHostfrom the settings table, so unsaved form edits are invisible to it. Triggering condition: pressing the test button before pressing Save.Already fixed: Not applicable — behaviour is unchanged on the default branch (
f727d04f, v3.7.0)Duplicate of: None
Evidence:
frontend/src/pages/settings/EmailTab.tsx:41—const res = (await HttpUtil.post('/panel/api/setting/testSmtp')) as SmtpTestResult;(no payload)internal/web/controller/setting.go:297—result := emailService.TestConnection()(no form binding intestSmtp, lines 291-313)internal/web/service/email/email.go:112—return SMTPTestResult{false, "connect", "smtpHostNotConfigured"}internal/web/service/setting.go:346-358—getStringhits GORM directly; no settings cache to go staleinternal/web/service/setting.go:1199-1247—UpdateAllSettingwrites everyentity.AllSettingfield by itsjsontag, includingsmtpHost(internal/web/entity/entity.go:53);CheckValid(internal/web/entity/entity.go:194-298) validatesSmtpFromonly, neverSmtpHostinternal/web/controller/setting.go:174— the save endpoint's only message key ispages.settings.toasts.modifySettingsinternal/web/service/email/email_test.go:183-206(TestConnectionReportsMissingFrom) pins thatTestConnectionreads settings from the DBNot determined: Whether the reporter's save actually persisted. Item 2 above (does the host survive a hard reload) settles it in one check.
Also found while investigating — two separate defects, present since
eec030f8(v3.4.0), still on the default branchNot the cause of this report, but they hit the same button as soon as the host is configured and the connection then fails:
Double i18n prefix.
classifySMTPErrorreturns keys that already carry the prefix —internal/web/service/email/email.go:331return "pages.settings.smtpErrorAuth"— while the frontend prefixes again:internal/web/service/email/email.goresults are rendered ast('pages.settings.' + testResult.msg)(frontend/src/pages/settings/EmailTab.tsx:202). The lookup becomespages.settings.pages.settings.smtpErrorAuth, which does not exist, andfrontend/src/i18n/react.ts:27-33sets noparseMissingKeyHandler, so the alert shows the raw key instead of "Authentication failed — check username and password". The four bare returns inTestConnection(smtpHostNotConfigured,smtpFromNotConfigured,smtpNoRecipients,smtpTestSuccess) are unprefixed, so those resolve correctly — the two conventions disagree inside one function.smtpErrorUnknowncan never resolve.internal/web/service/email/email.go:345returnsfmt.Sprintf("pages.settings.smtpErrorUnknown: %s", msg)— a key with the raw error concatenated onto it. Separately, its English value"smtpErrorUnknown": "SMTP error: {{ .Error }}"(internal/web/translation/en-US.json:1514) uses Go template syntax, while i18next here is initialised withinterpolation: { escapeValue: false, prefix: '{', suffix: '}' }(frontend/src/i18n/react.ts:31), so the placeholder would not be filled even if the key were reachable.This reply was generated automatically; a maintainer may follow up.
@qjds commented on GitHub (Aug 29, 2026):
Clicking the save button will still result in the error session MaxAge: Invalid input
@NgaiYeanCoi commented on GitHub (Aug 29, 2026):
Because the entire settings form fails validation,
smtpHostis never persisted, so “Send Test Email” reports that the SMTP host is not configured.Please open General Settings, set “Session Duration” to a valid integer between 60 and 525600 minutes (the default is 360), save the settings again, and then retry the SMTP test.
This appears to be related to #4681 rather than an SMTP-specific issue.
@qjds commented on GitHub (Aug 29, 2026):
Yes, this solves the problem. I don't know why the value here is 0. Maybe I have set it before, but shouldn't 0 be non expired