fix(mail): use html-to-text for plaintext email fallback (#4392)

This commit is contained in:
Waleed
2026-05-01 17:47:47 -07:00
committed by GitHub
parent da09a2a19c
commit cc28ba8c70
+2 -1
View File
@@ -1,4 +1,5 @@
import { createLogger } from '@sim/logger'
import { convert } from 'html-to-text'
import { type NextRequest, NextResponse } from 'next/server'
import { Resend } from 'resend'
import { mailSendContract } from '@/lib/api/contracts/tools/mail'
@@ -74,7 +75,7 @@ export const POST = withRouteHandler(async (request: NextRequest) => {
emailData = {
...emailBase,
html: validatedData.body,
text: validatedData.body.replace(/<[^>]*>/g, ''),
text: convert(validatedData.body, { wordwrap: false }),
}
} else {
emailData = {