SMTP config overwritten by wpIdentity
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, wordpress
- Lĩnh vực
- backend
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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);
}
- Ngôn ngữ chính
- HTML
- Star
- 11
- Fork
- 4
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của scripting/feedlandInstall
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 55/100
scripting/feedlandInstall#77 · 3 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
scripting/feedlandInstall#76 · 3 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 20/100
scripting/feedlandInstall#74 · 3 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
scripting/feedlandInstall#73 · 1 bình luận ·
-
New FeedLand releaseĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
scripting/feedlandInstall#72 · 3 bình luận · 1 reaction ·
Tất cả issue của scripting/feedlandInstall
Issue tương tự
-
Upgrade node-libzim to 4.7.0Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
openzim/mwoffliner#2933 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Use the README category name for website links and submissionsCó thể đã có người làm @dajiaohuang đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
birobirobiro/awesome-shadcn-ui#647 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Urigo/accounter-fullstack#4604 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
kagent-dev/tools#87 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
micronaut-projects/micronaut-core#13677 ·
Maintainer thường phản hồi trong vòng 1 ngày