Skip to content

Commit 4cc168d

Browse files
authored
Merge pull request #8640 from quarto-dev/quarto-email-empty-subject
Quarto email: ensure that lack of subject line is handled
2 parents 297a37e + 394834f commit 4cc168d

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

src/resources/filters/quarto-post/email.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ function generate_html_email_from_template(
185185
return html_str
186186
end
187187

188-
local subject = nil
188+
local subject = ""
189189
local email_images = {}
190190
local image_tbl = {}
191191
local suppress_scheduled_email = false
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
title: Email Test Document with No Subject Line
3+
author: Richard Iannone
4+
format: email
5+
---
6+
7+
The report content. Anything that is here is not part of the email message.
8+
9+
::: {.email}
10+
11+
::: {.email-text}
12+
An optional text-only version of the email message..
13+
:::
14+
15+
The HTML email content. Here you can add code cells, produce images, and write accompanying text.
16+
This content is not seen when viewing the rendered document on Connect (it's only
17+
seen when sending an email from the Connect document page). Emails from Connect
18+
can be sent manually, and they can also be scheduled.
19+
20+
:::
21+
22+
Any additional report content not part of the email message.

tests/smoke/render/render-email.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ testRender(docs("email/email.qmd"), "email", false, [fileExists(previewFile), va
3535
// Test basic attachment render, which will validate that attachment shows up in JSON
3636
testRender(docs("email/email-attach.qmd"), "email", false, [fileExists(previewFile), validJsonWithFields(jsonFile, {"rsc_email_subject": "The subject line.", "rsc_email_attachments": ["raw_data.csv"]})], cleanupCtx);
3737

38+
// Test an email render that has no subject line, this verifies that `rsc_email_subject` key is present and the value is an empty string
39+
testRender(docs("email/email-no-subject.qmd"), "email", false, [fileExists(previewFile), validJsonWithFields(jsonFile, {"rsc_email_subject": ""})], cleanupCtx);
40+
3841
// Render in a project with an output directory and confirm that everything ends up in the output directory
3942
testProjectRender(docs("email/project/email-attach.qmd"), "email", "_out", (outputDir: string) => {
4043
const verify: Verify[]= [];

0 commit comments

Comments
 (0)