mail page rest
This commit is contained in:
parent
c039291aea
commit
8d9694ba95
@ -258,11 +258,12 @@ function renderEmailContent(email: Email) {
|
||||
|
||||
// If we have HTML content, display it
|
||||
if (parsed.html) {
|
||||
const decodedHtml = decodeMIME(parsed.html, 'quoted-printable', 'utf-8');
|
||||
return (
|
||||
<div
|
||||
className="prose prose-sm sm:prose lg:prose-lg xl:prose-xl dark:prose-invert max-w-none"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: parsed.html
|
||||
__html: decodedHtml
|
||||
.replace(/<style[^>]*>[\s\S]*?<\/style>/gi, '')
|
||||
.replace(/<script[^>]*>[\s\S]*?<\/script>/gi, '')
|
||||
.replace(/<base[^>]*>/gi, '')
|
||||
@ -281,9 +282,10 @@ function renderEmailContent(email: Email) {
|
||||
|
||||
// If we have text content, display it
|
||||
if (parsed.text) {
|
||||
const decodedText = decodeMIME(parsed.text, 'quoted-printable', 'utf-8');
|
||||
return (
|
||||
<div className="whitespace-pre-wrap font-sans text-base leading-relaxed">
|
||||
{parsed.text.split('\n').map((line: string, i: number) => (
|
||||
{decodedText.split('\n').map((line: string, i: number) => (
|
||||
<p key={i} className="mb-2">{line}</p>
|
||||
))}
|
||||
</div>
|
||||
@ -310,7 +312,8 @@ function renderEmailContent(email: Email) {
|
||||
}
|
||||
|
||||
// If we couldn't parse the content, try to clean and display the raw body
|
||||
const cleanedContent = email.body
|
||||
const decodedBody = decodeMIME(email.body, 'quoted-printable', 'utf-8');
|
||||
const cleanedContent = decodedBody
|
||||
.replace(/Content-Type:[^\n]+/g, '')
|
||||
.replace(/Content-Transfer-Encoding:[^\n]+/g, '')
|
||||
.replace(/MIME-Version:[^\n]+/g, '')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user