Skip to content

fix(email): honour skipCssInline, and declare env/pwd on Config - #6

Open
MaxAdams98 wants to merge 1 commit into
boycce:masterfrom
MaxAdams98:fix/email-skip-css-inline-and-config-typedef
Open

MaxAdams98 wants to merge 1 commit into
boycce:masterfrom
MaxAdams98:fix/email-skip-css-inline-and-config-typedef

Conversation

@MaxAdams98

Copy link
Copy Markdown

Two small fixes in packages/core/server/email/index.js.

1. skipCssInline is ignored on a real send

if (!settings.skipCssInline || !settings.test) {

With skipCssInline: true and test: false this is false || true → still inlines. The flag only takes effect when the caller happens to also be in test mode, which is the one case where it matters least.

Verified against 0.3.15 by stubbing the nodemailer transport and reading the html handed to Mailgun on the real send path:

skipCssInline=true   -> inline style attrs: 35
skipCssInline=false  -> inline style attrs: 35

&& would be wrong in the other direction (test mode would stop inlining, which /email/:name and any test-mode render rely on), so the fix is to drop the clause: the flag should stand on its own.

2. Config omits env and pwd

@typedef {{ baseUrl?, emailFrom?, mailgunDomain?, mailgunKey?, name? }} Config

Both missing keys are load-bearing:

  • env is in requiredEmailConfigKeys (line 16) and throws at line 56 when absent
  • pwd is dereferenced at line 109, getDirectories(path, config.pwd)

So a caller passing the config sendEmail actually requires fails typecheck, and one that satisfies the typedef throws at runtime. Adding both.

How it turned up

A project on 0.3.15 wrapping sendEmail had to declare a local typedef to get a correct call past tsc, which is what sent me looking at the rest of the signature.

🤖 Generated with Claude Code

`skipCssInline` is ignored on a real send: `!skipCssInline || !test` is true
whenever test is false, so the flag only takes effect when the caller is also
in test mode. Dropping the `|| !test` makes the documented option work.

The `Config` typedef also omitted `env` and `pwd`, both of which sendEmail
needs: `env` is in requiredEmailConfigKeys and throws when absent, and `pwd`
is dereferenced for the template directory. Correct usage failed typecheck.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant