mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
fix(mail): use html-to-text for plaintext email fallback (#4392)
This commit is contained in:
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user