courrier clean 2$
This commit is contained in:
parent
afc7f64027
commit
1663721c89
File diff suppressed because it is too large
Load Diff
@ -136,6 +136,34 @@ export function formatForwardedEmail(email: EmailMessage): {
|
||||
// Get and clean original content
|
||||
const originalContent = cleanHtmlContent(email.content || email.html || email.text || '');
|
||||
|
||||
// Check if the content already has a forwarded message header
|
||||
// Look for common forwarded message header patterns
|
||||
const forwardedPatterns = [
|
||||
'---------- Forwarded message ---------',
|
||||
'Forwarded message',
|
||||
'-------- Original Message --------',
|
||||
'Begin forwarded message',
|
||||
'From:.*Date:.*Subject:.*To:', // Common pattern in forwarded emails
|
||||
'From:.*Sent:.*To:.*Subject:', // Microsoft Outlook pattern
|
||||
];
|
||||
|
||||
// Use a regular expression to check for all patterns, with case insensitivity
|
||||
const hasExistingHeader = forwardedPatterns.some(pattern =>
|
||||
new RegExp(pattern, 'i').test(originalContent)
|
||||
);
|
||||
|
||||
// If there's already a forwarded message header, don't add another one
|
||||
if (hasExistingHeader) {
|
||||
// Just wrap the content in appropriate styling without adding another header
|
||||
const content = `
|
||||
<div style="min-height: 20px;"></div>
|
||||
<div style="direction: ltr; text-align: left;" dir="ltr" class="email-original-content">
|
||||
${originalContent}
|
||||
</div>
|
||||
`;
|
||||
return { subject, content };
|
||||
}
|
||||
|
||||
// Create formatted content with explicit LTR formatting
|
||||
const content = `
|
||||
<div style="min-height: 20px;"></div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user