diff --git a/packages/jsx-email/src/renderer/render.ts b/packages/jsx-email/src/renderer/render.ts
index b235fa53..fe2787ea 100644
--- a/packages/jsx-email/src/renderer/render.ts
+++ b/packages/jsx-email/src/renderer/render.ts
@@ -95,7 +95,7 @@ const processHtml = async (config: JsxEmailConfig, html: string) => {
let result = docType + String(doc).replace('', '').replace('
', '');
result = result.replace(reJsxTags, '');
- result = result.replace(/<\/jsx-email-raw>/g, (_, p1) =>
+ result = result.replace(/<\/jsx-email-raw>/gs, (_, p1) =>
unescapeForRawComponent(p1)
);
diff --git a/packages/jsx-email/test/.snapshots/raw.test.tsx.snap b/packages/jsx-email/test/.snapshots/raw.test.tsx.snap
index a1c766b2..676dbb40 100644
--- a/packages/jsx-email/test/.snapshots/raw.test.tsx.snap
+++ b/packages/jsx-email/test/.snapshots/raw.test.tsx.snap
@@ -4,6 +4,12 @@ exports[` component > Should preserve content on plainText render 1`] = `"<
exports[` component > Should render without escaping 1`] = `"<#if firstname & lastname>Ola!#if>"`;
+exports[` component > Should work correctly when it has linebreaks 1`] = `
+"
+ Raw context
+ "
+`;
+
exports[` component > Should work correctly with a comment as a content 1`] = `"Ola!"`;
exports[` component > disablePlainTextOutput > Should not output to the plain text when enabled 1`] = `"Ola!"`;
diff --git a/packages/jsx-email/test/raw.test.tsx b/packages/jsx-email/test/raw.test.tsx
index 4eea43f7..4eee9572 100644
--- a/packages/jsx-email/test/raw.test.tsx
+++ b/packages/jsx-email/test/raw.test.tsx
@@ -46,6 +46,19 @@ describe(' component', async () => {
expect(actual).toMatchSnapshot();
});
+ it('Should work correctly when it has linebreaks', async () => {
+ const actual = await render(
+ <>
+
+ >
+ );
+ expect(actual).toMatchSnapshot();
+ });
+
describe('disablePlainTextOutput', () => {
it('Should not output to the plain text when enabled', async () => {
const actual = await render(