SMTP config overwritten by wpIdentity
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 55/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- javascript, wordpress
- 领域
- backend
调研方向
Start by reproducing the SMTP configuration with and without a wordpress block, then read sendmail.js and wpidentity.js around mail.start() and startMail(). Verify that the second startup does not replace an existing SMTP transport or force SES when wpIdentity has no SMTP settings, while preserving the documented behavior for both packages.
由索引模型根据 Issue 内容生成。
描述
This was noted in a pull request in the wpcomvip/feedland private repo. I investigated and found the following.
When there's a wordpress block in config, mail.start() gets called twice: once during core startup (using the complete merged config), and once by wpIdentity.startMail() (using only config.wordpress).
How to reproduce:
- Set up any FeedLand instance with working top-level SMTP settings (smtpHost, smtpPort, smtpUsername, smtpPassword) — email works fine at this point.
- Add a wordpress block to config (client ID/secret, etc.) to enable WordPress login, without putting smtp fields inside that block.
- Start the server. The logs show mail.start() called once with flUseSes: false (FeedLand's own startup), then again moments later with flUseSes: true (from wpidentity.start()).
- Trigger any email send (signup, login confirmation) — it now goes through SES instead of SMTP, and fails if SES isn't authorized.
I tried this out in in a local install.
Test 1: SMTP configured, no wordpress block: Mail delivered via SMTP
Test 2: SMTP configured, wordpress block added without smtp fields inside it: Mail routed to SES, failed
Test 3: SMTP configured, wordpress block added with smtp fields inside it: Mail delivered via SMTP
This bug involves several packages... wordland calls daveappserver which calls davemail, then wpIdentity calls davemail again. The solution I found involves two packages:
- in davemail (sendmail.js, start ()) don't overwrite the settings with SES if mailTransport is already defined
- in wpIdentity ( wpidentity.js, startMail ()) don't call mail.start() with "flUseSes: true" when wpIdentity itself has no SMTP settings, just use the mail config the host app already set up
I put the diffs below. The fix works for me with wordland locally, but can't say if it's the best or the correct fix. I'm unsure what happens in a different app where wpIdentity is not used together with daveappserver.
mail — sendmail.js
function start (options) { //1/23/23 by DW
var flUseSes = (options.flUseSes === undefined) ? true : utils.getBoolean (options.flUseSes);
+ if (flUseSes && (mailTransport !== undefined)) {
+ return;
+ }
config.flUseSes = flUseSes; //so davemail routines know whether to use SMTP or SES
if (!flUseSes) { //using SMTP
const nodemailerOptions = {
wpIdentity — wpidentity.js
function startMail () { //12/2/25 by DW
- var options;
- if (config.smtpHost === undefined) {
- options = {
- flUseSes: true
- };
- }
- else {
- options = {
+ if (config.smtpHost !== undefined) {
+ mail.start ({
flUseSes: false,
smtpHost: config.smtpHost,
port: config.smtpPort,
username: config.smtpUsername,
password: config.smtpPassword
- };
+ });
}
- mail.start (options);
}
- 主要语言
- HTML
- 星标
- 11
- 派生
- 4
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
scripting/feedlandInstall 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 64/100
scripting/feedlandInstall#75 · 3 条评论 · 1 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 55/100
scripting/feedlandInstall#77 · 3 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
scripting/feedlandInstall#76 · 3 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 20/100
scripting/feedlandInstall#74 · 3 条评论 ·
-
难度 4/5 3-5 天 新手友好度 20/100
scripting/feedlandInstall#73 · 1 条评论 ·
查看 scripting/feedlandInstall 的全部 Issue
相似的 Issue
-
bug CLI custom-model
难度 2/5 1-3 小时 新手友好度 75/100
-
bug confirmed issue
难度 2/5 1-3 小时 新手友好度 75/100
open-webui/open-webui#30750 · 1 条评论 ·
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
danielmiessler/LifeOS#2234 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
-
bug
难度 2/5 1-3 小时 新手友好度 75/100