[HITL] Human Input email body ignores plain‑text newlines in HTML rendering #22213

Closed
opened 2026-02-21 20:16:11 -05:00 by yindo · 1 comment
Owner

Originally created by @Blackoutta on GitHub (Feb 12, 2026).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.13.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Create a Human Input node with Email delivery enabled.
  2. In the email body, enter plain text with newline characters (e.g. three lines with {{#url#}} on line 1 and line 3).
  3. Trigger a delivery test or run a workflow that sends the email.
  4. Observe the received email content.

email input:
Image

received email:
Image

✔️ Expected Behavior

Even though the email body supports HTML, plain-text content should still render with proper line breaks. Newlines in the email body should appear as visible line breaks, so each line is on a separate line in the email.

ideal email content might look like this:
Image

Actual Behavior

The email renders the body as a single line, with \n effectively ignored (HTML rendering collapses whitespace).

Originally created by @Blackoutta on GitHub (Feb 12, 2026). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.13.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce 1. Create a Human Input node with Email delivery enabled. 2. In the email body, enter plain text with newline characters (e.g. three lines with `{{#url#}}` on line 1 and line 3). 3. Trigger a delivery test or run a workflow that sends the email. 4. Observe the received email content. email input: <img width="1460" height="778" alt="Image" src="https://github.com/user-attachments/assets/ec39191d-6f25-42dd-8f2b-f97504d668b0" /> received email: <img width="1702" height="568" alt="Image" src="https://github.com/user-attachments/assets/a842a964-a702-4180-8da7-f5eabf982502" /> ### ✔️ Expected Behavior Even though the email body supports HTML, plain-text content should still render with proper line breaks. Newlines in the email body should appear as visible line breaks, so each line is on a separate line in the email. ideal email content might look like this: <img width="868" height="426" alt="Image" src="https://github.com/user-attachments/assets/441e9cfc-bbd2-421d-bb45-932c2994cab8" /> ### ❌ Actual Behavior The email renders the body as a single line, with `\n` effectively ignored (HTML rendering collapses whitespace).
yindo added the 🐞 bug label 2026-02-21 20:16:11 -05:00
yindo closed this issue 2026-02-21 20:16:11 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 12, 2026):

Good news — this issue has already been identified and there's an open PR #32293 that fixes it by converting plain-text \n characters to HTML <br> tags when the email body doesn't already contain HTML markup.

The root cause is that the email body is passed to the mail sender with html=body, but plain-text newlines aren't converted to <br> tags beforehand, so HTML rendering collapses the whitespace as you observed.

You can track the PR for when it gets merged, or apply the fix locally if you need it immediately.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Feb 12, 2026): <!-- Answer --> Good news — this issue has already been identified and there's an open PR [#32293](https://github.com/langgenius/dify/pull/32293) that fixes it by converting plain-text `\n` characters to HTML `<br>` tags when the email body doesn't already contain HTML markup. The root cause is that the email body is passed to the mail sender with `html=body`, but plain-text newlines aren't converted to `<br>` tags beforehand, so HTML rendering collapses the whitespace as you observed. You can track the PR for when it gets merged, or apply the fix locally if you need it immediately. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/c54eae41-1527-4f2c-907a-c1021f333453?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/c54eae41-1527-4f2c-907a-c1021f333453?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/c54eae41-1527-4f2c-907a-c1021f333453?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/c54eae41-1527-4f2c-907a-c1021f333453?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/c54eae41-1527-4f2c-907a-c1021f333453?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/c54eae41-1527-4f2c-907a-c1021f333453?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/c54eae41-1527-4f2c-907a-c1021f333453?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=Good%20news%20%E2%80%94%20this%20issue%20has%20already%20been%20identified%20and%20there%27s%20an%20open%20PR%20%5B%2332293%5D%28https%3A//github.com/langgenius/dify/pull/32293%29%20that%20fixes%20it%20by%20converting%20plain-text%20%60%5Cn%60%20characters%20to%20HTML%20%60%3Cbr%3E%60%20tags%20when%20the%20email%20body%20doesn%27t%20already%20contain%20HTML%20markup.%0A%0AThe%20root%20cause%20is%20that%20the%20email%20body%20is%20passed%20to%20the%20mail%20sender%20with%20%60html%3Dbody%60%2C%20but%20plain-text%20newlines%20aren%27t%20converted%20to%20%60%3Cbr%3E%60%20tags%20beforehand%2C%20so%20HTML%20rendering%20collapses%20the%20whitespace%20as%20you%20observed.%0A%0AYou%20can%20track%20the%20PR%20for%20when%20it%20gets%20merged%2C%20or%20apply%20the%20fix%20locally%20if%20you%20need%20it%20immediately.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/32292)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#22213