|
|
|
@ -7,7 +7,7 @@ const parseHTMLString = (html, needText = false) => {
|
|
|
|
|
let bodyContent = doc.body.innerHTML
|
|
|
|
|
// bodyContent = bodyContent.replace(/<img/g, '<img onerror="this.onerror=null;this.src=\'https://hiana-crm.oss-accelerate.aliyuncs.com/WAMedia/afe412d4-3acf-4e79-a623-048aeb4d696a.png\';"')
|
|
|
|
|
const bodyText = (doc.body.innerText);
|
|
|
|
|
return needText ? { bodyContent, bodyText } : bodyContent
|
|
|
|
|
return needText ? { html, bodyContent, bodyText } : bodyContent
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -84,11 +84,11 @@ export const getEmailDetailAction = async (params) => {
|
|
|
|
|
const delLinefeed = mailType === 'text/html' ? (result.MailContent||'').includes('<html') ? true : false : true;
|
|
|
|
|
const cleanContent = (result.MailContent || '').replace(/\r\n/g, delLinefeed ? '' : ''); // <br>
|
|
|
|
|
|
|
|
|
|
const { bodyContent, bodyText } = mailType === 'text/html' ? parseHTMLString(cleanContent, true) : { bodyContent: '', bodyText: '' };
|
|
|
|
|
const { html, bodyContent, bodyText } = mailType === 'text/html' ? parseHTMLString(cleanContent, true) : { html: '', bodyContent: '', bodyText: '' };
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
info: { ...encodeEmailInfo(result.MailInfo?.[0] || {}), mailType },
|
|
|
|
|
content: mailType === 'text/html' ? bodyContent : result.MailContent || '',
|
|
|
|
|
content: mailType === 'text/html' ? html : result.MailContent || '',
|
|
|
|
|
abstract: bodyText || result.MailContent || '',
|
|
|
|
|
attachments: result?.AttachList || [],
|
|
|
|
|
}
|
|
|
|
|