Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/mail/components/mail/mail-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export function MailContent({ id, html, senderEmail }: MailContentProps) {
</button>
</div>
)}
<div ref={hostRef} className={cn('mail-content w-full flex-1 overflow-hidden')} />
<div ref={hostRef} className={cn('mail-content w-full flex-1 overflow-hidden px-4')} />
</>
);
}
16 changes: 8 additions & 8 deletions apps/server/src/lib/email-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ export function processEmailHtml({ html, shouldLoadImages, theme }: ProcessEmail
let hasBlockedImages = false;

const sanitizeConfig: sanitizeHtml.IOptions = {
allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img']),
allowedAttributes: false,
allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img', 'title']),
allowedAttributes: {
img: ['src', 'alt'],
a: ['href', 'target', 'rel'],
'*': ['style', 'class', 'width', 'height', 'colspan', 'rowspan'],
},
allowedSchemes: shouldLoadImages
? ['http', 'https', 'mailto', 'tel', 'data', 'cid', 'blob']
: ['http', 'https', 'mailto', 'tel', 'cid'],
Expand Down Expand Up @@ -47,6 +51,8 @@ export function processEmailHtml({ html, shouldLoadImages, theme }: ProcessEmail

const $ = cheerio.load(sanitized);

$('title').remove();

$('img[width="1"][height="1"]').remove();
$('img[width="0"][height="0"]').remove();

Expand Down Expand Up @@ -112,12 +118,6 @@ export function processEmailHtml({ html, shouldLoadImages, theme }: ProcessEmail
border-collapse: collapse;
}

.gmail_quote {
margin: 1em 0;
padding-left: 1em;
border-left: 1px solid ${theme === 'dark' ? '#666' : '#ccc'};
}

::selection {
background: #b3d4fc;
text-shadow: none;
Expand Down