Skip to content

A platform for community discussion. Free, open, simple.

Extract signatures from emails sent with Newton

Régis Hanol2b0e5051219c
diff --git a/lib/email/receiver.rb b/lib/email/receiver.rb
index a390c2061da..8de43f4b3ab 100644
--- a/lib/email/receiver.rb
+++ b/lib/email/receiver.rb
@@ -304,6 +304,7 @@ module Email
[:mozilla, / class="moz-/],
[:protonmail, / class="protonmail_/],
[:zimbra, / data-marker="__/],
+ [:newton, /(id|class)="cm_/],
]
def extract_from_gmail(doc)
@@ -360,6 +361,12 @@ module Email
to_markdown(doc.to_html, elided.to_html)
end
+ def extract_from_newton(doc)
+ # Removes anything that has an id or a class starting with 'cm_'
+ elided = doc.css("*[id^='cm_'], *[class^='cm_']").remove
+ to_markdown(doc.to_html, elided.to_html)
+ end
+
def trim_reply_and_extract_elided(text)
return [text, ""] if @opts[:skip_trimming]
EmailReplyTrimmer.trim(text, true)