Skip to content

Commit

Permalink
Fix new line in replies
Browse files Browse the repository at this point in the history
  • Loading branch information
elie222 committed Jan 23, 2025
1 parent aec078e commit 2c2e517
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions apps/web/utils/gmail/mail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,17 @@ export async function replyToEmail(
.join("\n");
const plainText = `${reply}\n\n${quotedHeader}\n${quotedContent}`;

// Format HTML version
// Format HTML version with <br> tags for line breaks
const htmlReply = reply.replace(/\n/g, "<br>");
const htmlContent = `
<div>${reply}</div>
<br/>
<div class="gmail_quote">
${quotedHeader}<br/>
<blockquote class="gmail_quote"
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
${message.textHtml || message.textPlain?.replace(/\n/g, "<br/>")}
</blockquote>
<div>${htmlReply}</div>
<div style="margin-top: 20px; padding-left: 10px; color: #666; border-left: 1px solid #ccc;">
<div>${quotedHeader}</div>
${message.textHtml || message.textPlain?.replace(/\n/g, "<br>")}
</div>
`;

// Create email
return sendEmail(
gmail,
{
Expand Down

0 comments on commit 2c2e517

Please sign in to comment.