Skip to content

Commit cc28ba8

Browse files
authored
fix(mail): use html-to-text for plaintext email fallback (#4392)
1 parent da09a2a commit cc28ba8

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • apps/sim/app/api/tools/mail/send

apps/sim/app/api/tools/mail/send/route.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { createLogger } from '@sim/logger'
2+
import { convert } from 'html-to-text'
23
import { type NextRequest, NextResponse } from 'next/server'
34
import { Resend } from 'resend'
45
import { mailSendContract } from '@/lib/api/contracts/tools/mail'
@@ -74,7 +75,7 @@ export const POST = withRouteHandler(async (request: NextRequest) => {
7475
emailData = {
7576
...emailBase,
7677
html: validatedData.body,
77-
text: validatedData.body.replace(/<[^>]*>/g, ''),
78+
text: convert(validatedData.body, { wordwrap: false }),
7879
}
7980
} else {
8081
emailData = {

0 commit comments

Comments
 (0)