From 2fa356ee6d1960941bf85f26c8cf23161b07e112 Mon Sep 17 00:00:00 2001 From: mic Date: Wed, 20 Aug 2025 15:49:06 +0200 Subject: [PATCH] trying a new way to get the plain text email in auto fetaures. see #469 --- mzta-background.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/mzta-background.js b/mzta-background.js index d15795e5..4f507230 100644 --- a/mzta-background.js +++ b/mzta-background.js @@ -976,10 +976,16 @@ async function processEmails(messages, addTagsAuto, spamFilter) { if (addTagsAuto || spamFilter) { curr_fullMessage = await browser.messages.getFull(message.id); msg_text = getMailBody(curr_fullMessage); - body_text = msg_text.text.replace(/\s+/g, ' ').trim(); + // body_text = msg_text.text.replace(/\s+/g, ' ').trim(); + // if( body_text.length == 0 ){ + // taLog.log("No text found in the message body, trying to convert HTML to plain text..."); + // body_text = htmlBodyToPlainText(msg_text.html); + // } + taLog.log("Startin from the HTML body if present and converting to plain text..."); + body_text = htmlBodyToPlainText(msg_text.html); if( body_text.length == 0 ){ - taLog.log("No text found in the message body, trying to convert HTML to plain text..."); - body_text = htmlBodyToPlainText(msg_text.html); + taLog.log("No HTML found in the message body, using plain text..."); + body_text = msg_text.text.replace(/\s+/g, ' ').trim(); } }