Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

SMTP config overwritten by wpIdentity

未关闭
#79 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 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:

  1. Set up any FeedLand instance with working top-level SMTP settings (smtpHost, smtpPort, smtpUsername, smtpPassword) — email works fine at this point.
  2. Add a wordpress block to config (client ID/secret, etc.) to enable WordPress login, without putting smtp fields inside that block.
  3. 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()).
  4. 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:

  1. in davemail (sendmail.js, start ()) don't overwrite the settings with SES if mailTransport is already defined
  2. 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.

mailsendmail.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 = {

wpIdentitywpidentity.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

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

scripting/feedlandInstall 的其他 Issue

查看 scripting/feedlandInstall 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。