New Upstream Release - ruby-email-reply-trimmer

Ready changes

Summary

Merged new upstream version: 0.1.13 (was: 0.1.6).

Resulting package

Built on 2022-09-28T19:12 (took 3m24s)

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-releases ruby-email-reply-trimmer

Lintian Result

Diff

diff --git a/Gemfile b/Gemfile
new file mode 100644
index 0000000..6008241
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,4 @@
+source 'https://rubygems.org'
+
+# Specify your gem's dependencies in email_reply_trimmer.gemspec
+gemspec
diff --git a/Rakefile b/Rakefile
index 32c08ef..0bec1a3 100644
--- a/Rakefile
+++ b/Rakefile
@@ -6,7 +6,7 @@ def version
   @version ||= File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*['"](?'version'\d+\.\d+\.\d+)['"]/, "version"]
 end
 
-task :default => :test
+task default: :test
 
 require "rake/testtask"
 Rake::TestTask.new(:test)
diff --git a/debian/changelog b/debian/changelog
index 20e5855..bc3c06c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,10 @@
-ruby-email-reply-trimmer (0.1.6-3) UNRELEASED; urgency=medium
+ruby-email-reply-trimmer (0.1.13-1) UNRELEASED; urgency=medium
 
   * Set upstream metadata fields: Bug-Database, Bug-Submit, Repository-Browse.
   * Update standards version to 4.6.1, no changes needed.
+  * New upstream release.
 
- -- Debian Janitor <janitor@jelmer.uk>  Wed, 28 Sep 2022 17:58:41 -0000
+ -- Debian Janitor <janitor@jelmer.uk>  Wed, 28 Sep 2022 19:10:01 -0000
 
 ruby-email-reply-trimmer (0.1.6-2) unstable; urgency=medium
 
diff --git a/email_reply_trimmer.gemspec b/email_reply_trimmer.gemspec
index 55b0726..e660406 100644
--- a/email_reply_trimmer.gemspec
+++ b/email_reply_trimmer.gemspec
@@ -15,6 +15,10 @@ Gem::Specification.new do |s|
   s.license = "MIT"
 
   s.require_paths = ["lib"]
-  s.files = Dir["**/*"].reject { |path| File.directory?(path) }
+  s.files = Dir["**/*"].reject { |path| File.directory?(path) || path =~ /.*\.gem$/ }
   s.test_files = s.files.select { |path| path =~ /^test\/.+_test\.rb$/ }
+
+  s.add_development_dependency 'rake', '~> 12'
+  s.add_development_dependency 'minitest', '~> 5'
+  s.add_development_dependency 'rubocop', '~> 0.52.1'
 end
diff --git a/lib/email_reply_trimmer.rb b/lib/email_reply_trimmer.rb
index 6ec95c8..d5e5d3f 100644
--- a/lib/email_reply_trimmer.rb
+++ b/lib/email_reply_trimmer.rb
@@ -6,7 +6,7 @@ require_relative "email_reply_trimmer/email_header_matcher"
 require_relative "email_reply_trimmer/quote_matcher"
 
 class EmailReplyTrimmer
-  VERSION = "0.1.6"
+  VERSION = "0.1.13"
 
   DELIMITER    = "d"
   EMBEDDED     = "b"
@@ -26,16 +26,11 @@ class EmailReplyTrimmer
     return TEXT
   end
 
-  def self.trim(text, split=false)
-    return if text.nil? || text =~ /\A[[:space:]]*\Z/m
+  def self.trim(text, split = false)
+    return if text.nil? || text =~ /\A[[:space:]]*\z/m
 
-    # normalize line endings
-    text.gsub!("\r\n", "\n")
-
-    # fix embedded email markers that might span over multiple lines
-    EmbeddedEmailMatcher::ON_DATE_SOMEONE_WROTE_REGEXES.each do |r|
-      text.gsub!(r) { |m| m.gsub(/\n[[:space:]>\-]*/, " ") }
-    end
+    # do some cleanup
+    preprocess!(text)
 
     # from now on, we'll work on a line-by-line basis
     lines = text.split("\n")
@@ -59,8 +54,8 @@ class EmailReplyTrimmer
     end
 
     # when the reply is at the end of the email
-    if pattern =~ /^b+q+[eq]*t[te]*$/
-      index = pattern =~ /t/
+    if is_reply_at_end?(pattern)
+      index = pattern =~ /t[et]*$/
       pattern = ""
       lines = lines[index..-1]
     end
@@ -75,12 +70,20 @@ class EmailReplyTrimmer
 
     # if there is an embedded email marker, followed by a huge quote
     # then take everything up to that marker
-    if pattern =~ /te*b[eqbh]*[te]*$/
+    if pattern =~ /te*b[eqbh]*([te]*)$/ && $1.count("t") < 7
       index = pattern =~ /te*b[eqbh]*[te]*$/
       pattern = pattern[0..index]
       lines = lines[0..index]
     end
 
+    # if there is some text before a huge quote ending the email,
+    # then remove the quote
+    if pattern =~ /t?e*[qbe]+$/
+      index = pattern =~ /t?e*[qbe]+$/
+      pattern = pattern[0..index]
+      lines = lines[0..index]
+    end
+
     # if there still are some embedded email markers, just remove them
     while pattern =~ /b/
       index = pattern =~ /b/
@@ -95,8 +98,8 @@ class EmailReplyTrimmer
       size.times.each { |s| pattern[index + s] = EMAIL_HEADER }
     end
 
-    # if there are at least 3 consecutive email headers, take everything up to
-    # these headers
+    # if there are at least 3 consecutive email headers,
+    # take everything up to these headers
     if pattern =~ /t[eq]*h{3,}/
       index = pattern =~ /t[eq]*h{3,}/
       pattern = pattern[0..index]
@@ -128,15 +131,10 @@ class EmailReplyTrimmer
   end
 
   def self.extract_embedded_email(text)
-    return if text.nil? || text =~ /\A[[:space:]]*\Z/m
+    return if text.nil? || text =~ /\A[[:space:]]*\z/m
 
-    # normalize line endings
-    text.gsub!("\r\n", "\n")
-
-    # fix embedded email markers that might span over multiple lines
-    EmbeddedEmailMatcher::ON_DATE_SOMEONE_WROTE_REGEXES.each do |r|
-      text.gsub!(r) { |m| m.gsub(/\n[[:space:]>\-]*/, " ") }
-    end
+    # do some cleanup
+    preprocess!(text)
 
     # from now on, we'll work on a line-by-line basis
     lines = text.split("\n")
@@ -146,6 +144,12 @@ class EmailReplyTrimmer
 
     if index = pattern =~ /(?:h[eqd]*?){3,}[tq]/
       embedded = lines[index..-1].join("\n").strip
+    elsif index = pattern =~ /b(?:[eqd]*){3,}[tq]/
+      # Exception for email clients (macOS / iOS) which embed fwd emails in quotes.
+      embedded = lines[index + 1..-1].map { |l| l.gsub(/^>\s*/, '') }.join("\n").strip
+    end
+
+    if index
       before = lines[0...(pattern[0...index] =~ /e*(b[eqd]*|b*[ed]*)$/)].join("\n").strip
       return [embedded, before]
     end
@@ -153,22 +157,62 @@ class EmailReplyTrimmer
 
   private
 
-    def self.compute_elided(text, lines)
-      elided = []
+  def self.preprocess!(text)
+    # normalize line endings
+    text.gsub!("\r\n", "\n")
+
+    # remove PGP markers
+    text.gsub!(/\A-----BEGIN PGP SIGNED MESSAGE-----\n(?:Hash: \w+)?\s+/i, "")
+    text.gsub!(/^-----BEGIN PGP SIGNATURE-----$[\s\S]+^-----END PGP SIGNATURE-----/, "")
 
-      t = 0
-      l = 0
+    # remove unsubscribe links
+    text.gsub!(/^Unsubscribe: .+@.+(\n.+http:.+)?\s*\z/i, "")
 
-      while t < text.size
-        while l < lines.size && text[t] == lines[l]
-          t += 1
-          l += 1
-        end
-        elided << text[t]
-        t += 1
+    # remove alias-style quotes marker
+    text.gsub!(/^.*>{5} "[^"\n]+" == .+ writes:/, "")
+
+    # change enclosed-style quotes format
+    text.gsub!(/^>>> ?(.+) ?>>>$\n([\s\S]+?)\n^<<< ?\1 ?<<<$/) { $2.gsub(/^/, "> ") }
+    text.gsub!(/^>{4,}[[:blank:]]*$\n([\s\S]+?)\n^<{4,}[[:blank:]]*$/) { $1.gsub(/^/, "> ") }
+
+    # fix all quotes formats
+    text.gsub!(/^((?:[[:blank:]]*[[:alpha:]]*[>|])+)/) { $1.gsub(/([[:alpha:]]+>|\|)/, ">") }
+
+    # fix embedded email markers that might span over multiple lines
+    (
+      EmbeddedEmailMatcher::ON_DATE_SOMEONE_WROTE_REGEXES +
+      EmbeddedEmailMatcher::SOMEONE_WROTE_ON_DATE_REGEXES +
+      EmbeddedEmailMatcher::DATE_SOMEONE_WROTE_REGEXES +
+      [EmbeddedEmailMatcher::DATE_SOMEONE_EMAIL_REGEX]
+    ).each do |r|
+      text.gsub!(r) do |m|
+        m.count("\n") > 4 ? m : m.gsub(/\n+[[:space:]]*/, " ")
       end
+    end
 
-      elided.join("\n").strip
+    # remove leading/trailing whitespaces
+    text.strip!
+  end
+
+  def self.compute_elided(text, lines)
+    elided = []
+
+    t = 0
+    l = 0
+
+    while t < text.size
+      while l < lines.size && text[t] == lines[l]
+        t += 1
+        l += 1
+      end
+      elided << text[t]
+      t += 1
     end
 
+    elided.join("\n").strip
+  end
+
+  def self.is_reply_at_end?(pattern)
+    pattern =~ /^b[^t]+t[et]*$/
+  end
 end
diff --git a/lib/email_reply_trimmer/delimiter_matcher.rb b/lib/email_reply_trimmer/delimiter_matcher.rb
index 74ac75c..dc4136e 100644
--- a/lib/email_reply_trimmer/delimiter_matcher.rb
+++ b/lib/email_reply_trimmer/delimiter_matcher.rb
@@ -1,6 +1,6 @@
 class DelimiterMatcher
 
-  DELIMITER_CHARACTERS ||= "-_,=+~#*ᐧ"
+  DELIMITER_CHARACTERS ||= "-_,=+~#*ᐧ—"
   DELIMITER_REGEX      ||= /^[[:blank:]]*[#{Regexp.escape(DELIMITER_CHARACTERS)}]+[[:blank:]]*$/
 
   def self.match?(line)
diff --git a/lib/email_reply_trimmer/email_header_matcher.rb b/lib/email_reply_trimmer/email_header_matcher.rb
index c177e0c..18afdad 100644
--- a/lib/email_reply_trimmer/email_header_matcher.rb
+++ b/lib/email_reply_trimmer/email_header_matcher.rb
@@ -1,12 +1,12 @@
 class EmailHeaderMatcher
 
-  EMAIL_HEADERS_WITH_DATE_MARKERS = [
-    # Dutch
+  EMAIL_HEADERS_WITH_DATE_MARKERS ||= [
+    # Norwegian
     ["Sendt"],
     # English
-    ["Sent"],
+    ["Sent", "Date"],
     # French
-    ["Date"],
+    ["Date", "Le"],
     # German
     ["Gesendet"],
     # Portuguese
@@ -17,19 +17,25 @@ class EmailHeaderMatcher
     ["Fecha"],
     # Italian
     ["Data"],
+    # Dutch
+    ["Datum"],
+    # Swedish
+    ["Skickat"],
+    # Chinese
+    ["发送时间"],
   ]
 
-  EMAIL_HEADERS_WITH_DATE_REGEXES = EMAIL_HEADERS_WITH_DATE_MARKERS.map do |header|
-    /^[[:blank:]>\*]*(?:#{header.join("|")})[[:blank:]\*]*:.*\d+/
+  EMAIL_HEADERS_WITH_DATE_REGEXES ||= EMAIL_HEADERS_WITH_DATE_MARKERS.map do |header|
+    /^[[:blank:]*]*(?:#{header.join("|")})[[:blank:]*]*:.*\d+/
   end
 
-  EMAIL_HEADERS_WITH_TEXT_MARKERS = [
-    # Dutch
+  EMAIL_HEADERS_WITH_TEXT_MARKERS ||= [
+    # Norwegian
     ["Fra", "Til", "Emne"],
     # English
     ["From", "To", "Cc", "Reply-To", "Subject"],
     # French
-    ["De", "À", "Répondre à", "Objet"],
+    ["De", "Expéditeur", "À", "Destinataire", "Répondre à", "Objet"],
     # German
     ["Von", "An", "Betreff"],
     # Portuguese
@@ -37,14 +43,20 @@ class EmailHeaderMatcher
     # Spanish
     ["De", "Para", "Asunto"],
     # Italian
-    ["Da", "Risposta", "A", "Oggetto"]
+    ["Da", "Risposta", "A", "Oggetto"],
+    # Dutch
+    ["Van", "Beantwoorden - Aan", "Aan", "Onderwerp"],
+    # Swedish
+    ["Från", "Till", "Ämne"],
+    # Chinese
+    ["发件人", "收件人", "主题"],
   ]
 
-  EMAIL_HEADERS_WITH_TEXT_REGEXES = EMAIL_HEADERS_WITH_TEXT_MARKERS.map do |header|
-    /^[[:blank:]>\*]*(?:#{header.join("|")})[[:blank:]\*]*:.*[[:word:]]+/
+  EMAIL_HEADERS_WITH_TEXT_REGEXES ||= EMAIL_HEADERS_WITH_TEXT_MARKERS.map do |header|
+    /^[[:blank:]*]*(?:#{header.join("|")})[[:blank:]*]*:.*[[:word:]]+/i
   end
 
-  EMAIL_HEADER_REGEXES = [
+  EMAIL_HEADER_REGEXES ||= [
     EMAIL_HEADERS_WITH_DATE_REGEXES,
     EMAIL_HEADERS_WITH_TEXT_REGEXES,
   ].flatten
diff --git a/lib/email_reply_trimmer/embedded_email_matcher.rb b/lib/email_reply_trimmer/embedded_email_matcher.rb
index 36e4d66..919eac9 100644
--- a/lib/email_reply_trimmer/embedded_email_matcher.rb
+++ b/lib/email_reply_trimmer/embedded_email_matcher.rb
@@ -10,38 +10,43 @@ class EmbeddedEmailMatcher
   # Dnia 14 lip 2015 o godz. 00:25 Michael Downey <info@discourse.org> napisał(a):
   # Em seg, 27 de jul de 2015 17:13, Neil Lalonde <info@discourse.org> escreveu:
   # El jueves, 21 de noviembre de 2013, codinghorror escribió:
-  # Am 03.02.2016 3:35 nachm. schrieb Max Mustermann <mail@example.com>:
-  ON_DATE_SOMEONE_WROTE_MARKERS = [
+  # At 6/16/2016 08:32 PM, you wrote:
+  ON_DATE_SOMEONE_WROTE_REGEXES ||= [
+    # Chinese
+    /^[[:blank:]<>-]*在 (?:(?!\b(?>在|写道)\b).)+?写道[[:blank:].:>-]*$/im,
     # Dutch
-    ["Op","het volgende geschreven"],
+    /^[[:blank:]<>-]*Op (?:(?!\b(?>Op|het\svolgende\sgeschreven|schreef)\b).)+?(het\svolgende\sgeschreven|schreef[^:]+)[[:blank:].:>-]*$/im,
     # English
-    ["On", "wrote"],
+    /^[[:blank:]<>-]*In message (?:(?!\b(?>In message|writes)\b).)+?writes[[:blank:].:>-]*$/im,
+    /^[[:blank:]<>-]*(On|At) (?:(?!\b(?>On|wrote|writes|says|said)\b).)+?(wrote|writes|says|said)[[:blank:].:>-]*$/im,
     # French
-    ["Le", "a écrit "],
+    /^[[:blank:]<>-]*Le (?:(?!\b(?>Le|nous\sa\sdit|a\s+écrit)\b).)+?(nous\sa\sdit|a\s+écrit)[[:blank:].:>-]*$/im,
+    # German
+    /^[[:blank:]<>-]*Am (?:(?!\b(?>Am|schrieben\sSie)\b).)+?schrieben\sSie[[:blank:].:>-]*$/im,
+    /^[[:blank:]<>-]*Am (?:(?!\b(?>Am|geschrieben)\b).)+?(geschrieben|schrieb[^:]+)[[:blank:].:>-]*$/im,
     # Italian
-    ["Il", "ha scritto"],
+    /^[[:blank:]<>-]*Il (?:(?!\b(?>Il|ha\sscritto)\b).)+?ha\sscritto[[:blank:].:>-]*$/im,
     # Polish
-    ["Dnia", "napisał\\(a\\)"],
+    /^[[:blank:]<>-]*(Dnia|Dňa) (?:(?!\b(?>Dnia|Dňa|napisał)\b).)+?napisał(\(a\))?[[:blank:].:>-]*$/im,
     # Portuguese
-    ["Em", "escreveu"],
+    /^[[:blank:]<>-]*Em (?:(?!\b(?>Em|escreveu)\b).)+?escreveu[[:blank:].:>-]*$/im,
     # Spanish
-    ["El", "escribió"],
-    # German
-    ["Am", "schrieb"],
+    /^[[:blank:]<>-]*El (?:(?!\b(?>El|escribió)\b).)+?escribió[[:blank:].:>-]*$/im,
   ]
 
-  ON_DATE_SOMEONE_WROTE_REGEXES = ON_DATE_SOMEONE_WROTE_MARKERS.map do |on, wrote|
-    wrote.gsub!(/ +/, "[[:space:]]+") # the "wrote" part might span over multiple lines
-    /^([[:blank:]>\-]*#{on}\s(?:(?!#{on}\s|#{wrote}:?)[\s\S])*#{wrote}:?[[:blank:]\-]*)$/m
-  end
-
   # Op 10 dec. 2015 18:35 schreef "Arpit Jalan" <info@discourse.org>:
   # Am 18.09.2013 um 16:24 schrieb codinghorror <info@discourse.org>:
+  # Den 15. jun. 2016 kl. 20.42 skrev Jeff Atwood <info@discourse.org>:
+  # søn. 30. apr. 2017 kl. 00.26 skrev David Taylor <meta@discoursemail.com>:
   ON_DATE_WROTE_SOMEONE_MARKERS = [
     # Dutch
     ["Op", "schreef"],
     # German
     ["Am", "schrieb"],
+    # Norwegian
+    ["Den", "skrev"],
+    # Dutch
+    ["søn\.", "skrev"],
   ]
 
   ON_DATE_WROTE_SOMEONE_REGEXES = ON_DATE_WROTE_SOMEONE_MARKERS.map do |on, wrote|
@@ -49,15 +54,31 @@ class EmbeddedEmailMatcher
   end
 
   # суббота, 14 марта 2015 г. пользователь etewiah написал:
+  # 23 mar 2017 21:25 "Neil Lalonde" <meta@discoursemail.com> napisał(a):
+  # 30 серп. 2016 р. 20:45 "Arpit" no-reply@example.com пише:
   DATE_SOMEONE_WROTE_MARKERS = [
     # Russian
     ["пользователь", "написал"],
+    # Polish
+    ["", "napisał\\(a\\)"],
+    # Ukrainian
+    ["", "пише"],
   ]
 
   DATE_SOMEONE_WROTE_REGEXES = DATE_SOMEONE_WROTE_MARKERS.map do |user, wrote|
-    /.+#{user}.+#{wrote}:/
+    user.size == 0 ?
+      /\d{4}.{1,80}\n?.{0,80}?#{wrote}:/ :
+      /\d{4}.{1,80}#{user}.{0,80}\n?.{0,80}?#{wrote}:/
   end
 
+  # Max Mustermann <try_discourse@discoursemail.com> schrieb am Fr., 28. Apr. 2017 um 11:53 Uhr:
+  SOMEONE_WROTE_ON_DATE_REGEXES ||= [
+    # English
+    /^.+\bwrote\b[[:space:]]+\bon\b.+[^:]+:/,
+    # German
+    /^.+\bschrieb\b[[:space:]]+\bam\b.+[^:]+:/,
+  ]
+
   # 2016-03-03 17:21 GMT+01:00 Some One
   ISO_DATE_SOMEONE_REGEX = /^[[:blank:]>]*20\d\d-\d\d-\d\d \d\d:\d\d GMT\+\d\d:\d\d [\w[:blank:]]+$/
 
@@ -65,7 +86,7 @@ class EmbeddedEmailMatcher
   # 2013/10/2 camilohollanda <info@discourse.org>
   # вт, 5 янв. 2016 г. в 23:39, Erlend Sogge Heggen <info@discourse.org>:
   # ср, 1 апр. 2015, 18:29, Denis Didkovsky <info@discourse.org>:
-  DATE_SOMEONE_EMAIL_REGEX = /^[[:blank:]>]*.*\d{4}.+<[^@<>]+@[^@<>.]+\.[^@<>]+>:?$/
+  DATE_SOMEONE_EMAIL_REGEX = /\d{4}.{1,80}\s?<[^@<>]+@[^@<>.]+\.[^@<>]+>:?$/
 
   # codinghorror via Discourse Meta wrote:
   # codinghorror via Discourse Meta <info@discourse.org> schrieb:
@@ -77,11 +98,12 @@ class EmbeddedEmailMatcher
   ]
 
   SOMEONE_VIA_SOMETHING_WROTE_REGEXES = SOMEONE_VIA_SOMETHING_WROTE_MARKERS.map do |wrote|
-    /^[[:blank:]>]*.+ via .+ #{wrote}:?[[:blank:]]*$/
+    /^.+ via .+ #{wrote}:?[[:blank:]]*$/
   end
 
   # Some One <info@discourse.org> wrote:
-  SOMEONE_EMAIL_WROTE_REGEX = /^[[:blank:]>]*.+ <.+@.+\..+> wrote:?/
+  # Gavin Sinclair (gsinclair@soyabean.com.au) wrote:
+  SOMEONE_EMAIL_WROTE_REGEX = /^.+\b[\w.+-]+@[\w.-]+\.\w{2,}\b.+wrote:?$/
 
   # Posted by mpalmer on 01/21/2016
   POSTED_BY_SOMEONE_ON_DATE_REGEX = /^[[:blank:]>]*Posted by .+ on \d{2}\/\d{2}\/\d{4}$/i
@@ -92,17 +114,21 @@ class EmbeddedEmailMatcher
   # ----- Original Message -----
   # -----Original Message-----
   # *----- Original Message -----*
+  # ----- Reply message -----
+  # ------------------ 原始邮件 ------------------
   FORWARDED_EMAIL_REGEXES = [
     # English
     /^[[:blank:]>]*Begin forwarded message:/i,
-    /^[[:blank:]>]*Reply message/i,
-    /^[[:blank:]>\*]*-{2,}[[:blank:]]*(Forwarded|Original) Message[[:blank:]]*-{2,}/i,
+    /^[[:blank:]>*]*-{2,}[[:blank:]]*(Forwarded|Original|Reply) Message[[:blank:]]*-{2,}/i,
     # French
-    /^[[:blank:]>\*]*-{2,}[[:blank:]]*Message transféré[[:blank:]]*-{2,}/i,
+    /^[[:blank:]>]*Début du message transféré :/i,
+    /^[[:blank:]>*]*-{2,}[[:blank:]]*Message transféré[[:blank:]]*-{2,}/i,
     # German
-    /^[[:blank:]>\*]*-{2,}[[:blank:]]*Ursprüngliche Nachricht[[:blank:]]*-{2,}/i,
+    /^[[:blank:]>*]*-{2,}[[:blank:]]*Ursprüngliche Nachricht[[:blank:]]*-{2,}/i,
     # Spanish
-    /^[[:blank:]>\*]*-{2,}[[:blank:]]*Mensaje original[[:blank:]]*-{2,}/i,
+    /^[[:blank:]>*]*-{2,}[[:blank:]]*Mensaje original[[:blank:]]*-{2,}/i,
+    # Chinese
+    /^[[:blank:]>*]*-{2,}[[:blank:]]*原始邮件[[:blank:]]*-{2,}/i,
   ]
 
   EMBEDDED_REGEXES = [
@@ -110,6 +136,7 @@ class EmbeddedEmailMatcher
     ON_DATE_WROTE_SOMEONE_REGEXES,
     DATE_SOMEONE_WROTE_REGEXES,
     DATE_SOMEONE_EMAIL_REGEX,
+    SOMEONE_WROTE_ON_DATE_REGEXES,
     ISO_DATE_SOMEONE_REGEX,
     SOMEONE_VIA_SOMETHING_WROTE_REGEXES,
     SOMEONE_EMAIL_WROTE_REGEX,
diff --git a/lib/email_reply_trimmer/signature_matcher.rb b/lib/email_reply_trimmer/signature_matcher.rb
index 8a5b987..8dea785 100644
--- a/lib/email_reply_trimmer/signature_matcher.rb
+++ b/lib/email_reply_trimmer/signature_matcher.rb
@@ -13,24 +13,38 @@ class SignatureMatcher
   # (sent from a phone)
   # (Sent from mobile device)
   # 從我的 iPhone 傳送
-  SIGNATURE_REGEXES = [
+  SIGNATURE_REGEXES ||= [
     # Chinese
-    /^[[:blank:]>]*從我的 iPhone 傳送/i,
+    /^[[:blank:]]*從我的 iPhone 傳送/i,
     # English
-    /^[[:blank:]>]*[[:word:]]+ from mobile/i,
-    /^[[:blank:]>]*[\(<]*sent (?:from|via|with|by) .+[\)>]*/i,
-    /^[[:blank:]>]*from my .{1,20}/i, # don't match too much
+    /^[[:blank:]]*[[:word:]]+ from mobile/i,
+    /^[[:blank:]]*[\(<]*Sent (from|via|with|by) .+[\)>]*/i,
+    /^[[:blank:]]*From my .{1,20}/i,
+    /^[[:blank:]]*Get Outlook for /i,
     # French
-    /^[[:blank:]>]*Envoyé depuis mon .+/i,
+    /^[[:blank:]]*Envoyé depuis (mon|Yahoo Mail)/i,
     # German
-    /^[[:blank:]>]*Von meinem .+ gesendet/i,
-    /^[[:blank:]>]*Diese Nachricht wurde von .+ gesendet/i,
+    /^[[:blank:]]*Von meinem .+ gesendet/i,
+    /^[[:blank:]]*Diese Nachricht wurde von .+ gesendet/i,
+    # Italian
+    /^[[:blank:]]*Inviato da /i,
+    # Norwegian
+    /^[[:blank:]]*Sendt fra min /i,
+    # Portuguese
+    /^[[:blank:]]*Enviado do meu /i,
     # Spanish
-    /^[[:blank:]>]*Enviado desde mi .+/i,
+    /^[[:blank:]]*Enviado desde mi /i,
+    # Dutch
+    /^[[:blank:]]*Verzonden met /i,
+    /^[[:blank:]]*Verstuurd vanaf mijn /i,
+    # Swedish
+    /^[[:blank:]]*från min /i,
   ]
 
   def self.match?(line)
-    SIGNATURE_REGEXES.any? { |r| line =~ r }
+    # remove any markdown links
+    stripped = line.gsub(/\[([^\]]+)\]\([^\)]+\)/) { $1 }
+    SIGNATURE_REGEXES.any? { |r| stripped =~ r }
   end
 
 end
diff --git a/test/before/forwarded_apple.txt b/test/before/forwarded_apple.txt
new file mode 100644
index 0000000..e8c173f
--- /dev/null
+++ b/test/before/forwarded_apple.txt
@@ -0,0 +1 @@
+This email has been forwarded from Apple Mail.
diff --git a/test/before/forwarded_gmail.txt b/test/before/forwarded_gmail.txt
new file mode 100644
index 0000000..fd75a53
--- /dev/null
+++ b/test/before/forwarded_gmail.txt
@@ -0,0 +1 @@
+This email has been forwarded from Gmail.
diff --git a/test/elided/email_headers_5.txt b/test/elided/email_headers_5.txt
new file mode 100644
index 0000000..1fef46f
--- /dev/null
+++ b/test/elided/email_headers_5.txt
@@ -0,0 +1,23 @@
+From: Erlend Sogge Heggen <meta@discoursemail.com>
+Reply-To: Erlend Sogge Heggen <meta+abcd@discoursemail.com>
+Date: Wednesday, 5 April 2017 at 17:01
+To: Jef <jef@bar.com>
+Subject: [Discourse Meta] [PM] Discourse for Communities of Practice, educational organisation
+
+
+erlend_sh<https://meta.discourse.org/u/erlend_sh> Erlend Sogge Heggen<https://meta.discourse.org/u/erlend_sh> Team
+April 5
+
+
+
+Hi Jef,
+
+Is your University a legally recognised educational institution? Otherwise I'm afraid you're not eligible for this discount.
+
+Sincerely,
+
+Erlend
+
+
+
+This email message and any attachments may contain confidential information and may be privileged. If you are not the intended recipient or otherwise not authorized to receive this message, you are prohibited to use, copy, disclose or take any action based on this email or any information contained herein. If you are not the intended recipient, please advise the sender immediately by replying to this email and permanently delete this message and any attachments from your system.
diff --git a/test/elided/embedded_ception.txt b/test/elided/embedded_ception.txt
index fd53f8e..954ce1c 100644
--- a/test/elided/embedded_ception.txt
+++ b/test/elided/embedded_ception.txt
@@ -2,7 +2,7 @@ On Mon, Feb 1, 2016 at 6:32 PM, Jeff Atwood <info@discourse.org> wrote:
 
 > This is Jeff's reply.
 >
-> On Mon, Feb 1, 2016 at 7:50 AM, Some One <foo@bar.com wrote:
+> On Mon, Feb 1, 2016 at 7:50 AM, Some One <foo@bar.com > > wrote:
 >
 >> Great!
 >>
@@ -14,7 +14,7 @@ On Mon, Feb 1, 2016 at 6:32 PM, Jeff Atwood <info@discourse.org> wrote:
 >>
 >>> WAT?
 >>>
->>> On Wed, Jan 27, 2016 at 10:48 PM, Some One < foo@bar.com> wrote:
+>>> On Wed, Jan 27, 2016 at 10:48 PM, Some One < >>> foo@bar.com> wrote:
 >>>
 >>>> Hi Team,
 >>>>
@@ -22,7 +22,7 @@ On Mon, Feb 1, 2016 at 6:32 PM, Jeff Atwood <info@discourse.org> wrote:
 >>>>
 >>>> Some One
 >>>>
->>>> On Wed, Jan 27, 2016 at 10:10 AM Discourse Team <team@discourse.org> wrote:
+>>>> On Wed, Jan 27, 2016 at 10:10 AM Discourse Team <team@discourse.org> >>>> wrote:
 >>>>
 >>>>> Hello :waves_hand:
 >>>>>
diff --git a/test/elided/embedded_email_12.txt b/test/elided/embedded_email_12.txt
index aeda6fa..b136923 100644
--- a/test/elided/embedded_email_12.txt
+++ b/test/elided/embedded_email_12.txt
@@ -1,8 +1,8 @@
-On Thu, 31 Mar 2016 at 11:16 Some One < mailto:Some One <some.one@foo.bar> wrote:
+On Thu, 31 Mar 2016 at 11:16 Some One < mailto:Some One <some.one@foo.bar> > wrote:
 
 
 Two 2
 
-On Thu, 31 Mar 2016 at 10:05 Jeff Atwood < mailto:Jeff Atwood <team@discourse.org> wrote:
+On Thu, 31 Mar 2016 at 10:05 Jeff Atwood < mailto:Jeff Atwood <team@discourse.org> > wrote:
 
 Three 3
diff --git a/test/elided/embedded_email_13.txt b/test/elided/embedded_email_13.txt
new file mode 100644
index 0000000..16d71cc
--- /dev/null
+++ b/test/elided/embedded_email_13.txt
@@ -0,0 +1,9 @@
+At 6/16/2016 08:32 PM, you wrote:
+><https://meta.discourse.org/users/codinghorror>codinghorror
+><https://meta.discourse.org/users/codinghorror>Jeff Atwood co-founder
+>June 17
+>
+>Sorry I got a little mixed up with all the incoming replies. Are you
+>able to log in?
+>
+>Use your email address and "forgot password" if you need it reset.
diff --git a/test/elided/embedded_email_14.txt b/test/elided/embedded_email_14.txt
new file mode 100644
index 0000000..279c969
--- /dev/null
+++ b/test/elided/embedded_email_14.txt
@@ -0,0 +1,11 @@
+2016-10-24 15:36 GMT+02:00 Foo bar < info@foo.bar>:
+
+> Thank you so much Erlend, very thanks!
+>
+> 2016-10-24 15:03 GMT+02:00 Erlend Sogge Heggen <meta@discoursemail.com>:
+>
+>> erlend_sh <https://meta.discourse.org/users/erlend_sh> Erlend Sogge
+>> Heggen <https://meta.discourse.org/users/erlend_sh> team
+>> October 24
+>>
+>> I received your application and I've replied with setup instructions.
diff --git a/test/elided/embedded_email_15.txt b/test/elided/embedded_email_15.txt
new file mode 100644
index 0000000..21423f9
--- /dev/null
+++ b/test/elided/embedded_email_15.txt
@@ -0,0 +1,4 @@
+2017-02-05 13:29 GMT+02:00 Very long author name < notifications@forum.some-discourse-host.local>:
+
+> [Original Messages is quoted here]
+> [...]
diff --git a/test/elided/embedded_email_16.txt b/test/elided/embedded_email_16.txt
new file mode 100644
index 0000000..949897c
--- /dev/null
+++ b/test/elided/embedded_email_16.txt
@@ -0,0 +1,4 @@
+--
+Eric Hodel - drbrain@segment7.net - http://segment7.net
+All messages signed with fingerprint:
+FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04
diff --git a/test/elided/embedded_email_17.txt b/test/elided/embedded_email_17.txt
new file mode 100644
index 0000000..396fe3f
--- /dev/null
+++ b/test/elided/embedded_email_17.txt
@@ -0,0 +1,2 @@
+On 15 May 2017 19:32, "Nomadic Sprite" <nomadic.sprite01@gmail.com> wrote:
+On 8 May 2017 6:51 pm, "Andy Jones" <Andy.Jones@jameshall.co.uk> wrote:
diff --git a/test/elided/embedded_email_18.txt b/test/elided/embedded_email_18.txt
new file mode 100644
index 0000000..4aea36f
--- /dev/null
+++ b/test/elided/embedded_email_18.txt
@@ -0,0 +1 @@
+On 8 May 2017 17:34, "Andy Jones" <Andy.Jones@jameshall.co.uk> wrote:
diff --git a/test/elided/embedded_email_19.txt b/test/elided/embedded_email_19.txt
new file mode 100644
index 0000000..e69de29
diff --git a/test/elided/embedded_email_chinese.txt b/test/elided/embedded_email_chinese.txt
new file mode 100644
index 0000000..c147178
--- /dev/null
+++ b/test/elided/embedded_email_chinese.txt
@@ -0,0 +1,4 @@
+> 在 2016年12月12日,下午8:45,Erlend Sogge Heggen <meta@discoursemail.com> 写道:
+> fu.zhang:
+> Some random question
+>
diff --git a/test/elided/embedded_email_german_4.txt b/test/elided/embedded_email_german_4.txt
new file mode 100644
index 0000000..0503b5c
--- /dev/null
+++ b/test/elided/embedded_email_german_4.txt
@@ -0,0 +1,15 @@
+Max Mustermann <try_discourse@discoursemail.com> schrieb am Fr., 28. Apr. 2017 um 11:53 Uhr:
+
+> max_2 <http://try.discourse.org/u/cfstras_2>
+> April 28
+
+> Hi there! you should be getting a mail.
+> ------------------------------
+
+> Visit Topic <http://try.discourse.org/t/this-is-my-internal-test/716/2>
+> or reply to this email to respond.
+
+> To unsubscribe from these emails, click here
+> <http://try.discourse.org/email/unsubscribe/badf00d>
+> .
+
diff --git a/test/elided/embedded_email_german_5.txt b/test/elided/embedded_email_german_5.txt
new file mode 100644
index 0000000..0fb489f
--- /dev/null
+++ b/test/elided/embedded_email_german_5.txt
@@ -0,0 +1,20 @@
+Erlend Sogge Heggen <meta@discoursemail.com> schrieb am Di., 16. Aug. 2016 um 12:52 Uhr:
+
+> erlend_sh <https://meta.discourse.org/users/erlend_sh> Erlend Sogge Heggen
+> <https://meta.discourse.org/users/erlend_sh> team
+> August 16
+>
+> Hi Bob,
+>
+> Sure, it sounds like your requirements would fit our Standard plan. I
+> suggest you sign up for a free trial, as that will be the best way to see
+> for yourself if we support the kind of custom styling
+>
+> Sincerely,
+>
+> Erlend
+>
+--
+Viele Grüße / Best regards
+
+Bob
diff --git a/test/elided/embedded_email_german_6.txt b/test/elided/embedded_email_german_6.txt
new file mode 100644
index 0000000..d365cf2
--- /dev/null
+++ b/test/elided/embedded_email_german_6.txt
@@ -0,0 +1,8 @@
+Am 21.04.2016 17:48 schrieb "Einz Zwei" <noreply@discourse.pseuco.com >:
+
+> einz.zwei <https://discourse.pseuco.com/users/einz.zwei> einz
+> zwei <https://discourse.pseuco.com/users/einz.zwei>
+> 21. April
+>
+> Vielleicht noch eine wichtige Frage:
+> Wann sollten wir diese Trainingsvideos veröffentlichen, es gibt 2
diff --git a/test/elided/embedded_email_norwegian.txt b/test/elided/embedded_email_norwegian.txt
new file mode 100644
index 0000000..2b6824c
--- /dev/null
+++ b/test/elided/embedded_email_norwegian.txt
@@ -0,0 +1,9 @@
+Sendt fra min iPad
+
+Den 15. jun. 2016 kl. 20.42 skrev Jeff Atwood <info@discourse.org<mailto:info@discourse.org>>:
+
+        codinghorror<https://meta.discourse.org/users/codinghorror> Jeff Atwood<https://meta.discourse.org/users/codinghorror> co-founder
+June 15
+
+
+Enable tags in your admin, site settings.
diff --git a/test/elided/embedded_email_polish.txt b/test/elided/embedded_email_polish_1.txt
similarity index 100%
rename from test/elided/embedded_email_polish.txt
rename to test/elided/embedded_email_polish_1.txt
diff --git a/test/elided/embedded_email_polish_2.txt b/test/elided/embedded_email_polish_2.txt
new file mode 100644
index 0000000..68fbfa0
--- /dev/null
+++ b/test/elided/embedded_email_polish_2.txt
@@ -0,0 +1,7 @@
+23 mar 2017 21:25 "Neil Lalonde" <meta@discoursemail.com> napisał(a):
+
+> neil <https://meta.discourse.org/users/neil> Neil Lalonde
+> <https://meta.discourse.org/users/neil> Team
+> March 23
+>
+> I have made required changes. Enjoy!
diff --git a/test/elided/embedded_email_quote_text.txt b/test/elided/embedded_email_quote_text.txt
index 05c185f..4afe440 100644
--- a/test/elided/embedded_email_quote_text.txt
+++ b/test/elided/embedded_email_quote_text.txt
@@ -1 +1,6 @@
 On Mon, Aug 19, 2013 at 2:36 AM, SomeOne via Discourse Meta < info@discourse.org> wrote:
+
+> This seems like a problem that would be better solved at the web server
+> level, rather than by the application. If nothing else, adding an instance
+> of Nginx as an SSL/TLS reverse-proxy would very quickly take care of this.
+>
diff --git a/test/elided/embedded_email_russian.txt b/test/elided/embedded_email_russian_1.txt
similarity index 100%
rename from test/elided/embedded_email_russian.txt
rename to test/elided/embedded_email_russian_1.txt
diff --git a/test/elided/embedded_email_russian_2.txt b/test/elided/embedded_email_russian_2.txt
new file mode 100644
index 0000000..a97036c
--- /dev/null
+++ b/test/elided/embedded_email_russian_2.txt
@@ -0,0 +1,23 @@
+20 окт. 2016 г. 19:37 пользователь "Rafael dos Santos Silva" < meta@discoursemail.com> написал:
+
+> Falco <https://meta.discourse.org/users/falco> Rafael dos Santos Silva
+> <https://meta.discourse.org/users/falco> team
+> October 20
+>
+> Are you using our official docker install?
+>
+> If you are, try a rebuild:
+>
+> ssh root@server
+> cd /var/discourse
+> ./launcher rebuild app
+>
+> ------------------------------
+>
+> Visit Topic <https://meta.discourse.org/t/error-upgrading/51797/2> or
+> reply to this email to respond.
+>
+> To unsubscribe from these emails, click here
+> <https://meta.discourse.org/email/unsubscribe/184ce11578cd0abaddcb6e7460708971afed7278523347d3184a421229d87d08>
+> .
+>
diff --git a/test/elided/embedded_email_swedish.txt b/test/elided/embedded_email_swedish.txt
new file mode 100644
index 0000000..7ee3cb3
--- /dev/null
+++ b/test/elided/embedded_email_swedish.txt
@@ -0,0 +1,8 @@
+Från: Foo Bar [mailto:noreply@foo.bar]
+Skickat: den 5 juni 2017 12:22
+Till: someone@domain.com
+Ämne: [WAT] Photos from the symposium
+
+If you have any pictures from any parts of the symposium that you are willing to share, please reply to this post to share them (you can simply copy and paste or drag'n'drop them into the text).
+
+Here are the group pictures we took on Wednesday after lunch.
diff --git a/test/elided/embedded_email_ukrainian.txt b/test/elided/embedded_email_ukrainian.txt
new file mode 100644
index 0000000..4d9405f
--- /dev/null
+++ b/test/elided/embedded_email_ukrainian.txt
@@ -0,0 +1,17 @@
+30 серп. 2016 р. 20:45 "Arpit" <no-reply@example.com> пише:
+
+> meg <http://forum.example.com/users/foo> Foo
+> <http://forum.example.com/users/foo>
+> Август 30
+>
+> Когда будет точное название, напишите в личку и мы поменяем название.
+> ------------------------------
+>
+> Visit Message
+> <http://forum.example.com/t/slug/24>
+> or reply to this email to respond.
+>
+> To unsubscribe from these emails, click here
+> <http://forum.example.com/email/unsubscribe/0123456789>
+> .
+>
diff --git a/test/elided/forwarded_apple.txt b/test/elided/forwarded_apple.txt
new file mode 100644
index 0000000..f37c645
--- /dev/null
+++ b/test/elided/forwarded_apple.txt
@@ -0,0 +1,15 @@
+> Begin forwarded message:
+>
+> From: Foo Discourse <foo@discourse.org>
+> Subject: This email is going to be forwarded
+> Date: 01 January 2019 at 12:00:00 EET
+> To: bar@discourse.org
+>
+> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi auctor
+> lacus in metus vehicula, non dictum mi consequat. Nunc eget quam sit
+> amet dolor scelerisque cursus. Etiam laoreet lectus a rutrum
+> sollicitudin. Nullam sit amet lorem id ante lobortis fringilla. Duis
+> dictum tempus sem et ultrices. Sed ac lectus ante. Vivamus interdum,
+> risus non tincidunt accumsan, purus mi accumsan dolor, vitae euismod
+> turpis orci ut est. Integer ut ante eu velit dignissim ullamcorper non
+> id nibh. Nulla auctor magna erat, et posuere sapien gravida convallis.
diff --git a/test/elided/forwarded_gmail.txt b/test/elided/forwarded_gmail.txt
new file mode 100644
index 0000000..420c5fd
--- /dev/null
+++ b/test/elided/forwarded_gmail.txt
@@ -0,0 +1,15 @@
+---------- Forwarded message ---------
+From: Foo Discourse <foo@discourse.org>
+Date: Tue, Jan 01, 2019 at 12:00 PM
+Subject: This email is going to be forwarded
+To: <bar@discourse.org>
+
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi auctor
+lacus in metus vehicula, non dictum mi consequat. Nunc eget quam sit
+amet dolor scelerisque cursus. Etiam laoreet lectus a rutrum
+sollicitudin. Nullam sit amet lorem id ante lobortis fringilla. Duis
+dictum tempus sem et ultrices. Sed ac lectus ante. Vivamus interdum,
+risus non tincidunt accumsan, purus mi accumsan dolor, vitae euismod
+turpis orci ut est. Integer ut ante eu velit dignissim ullamcorper non
+id nibh. Nulla auctor magna erat, et posuere sapien gravida convallis.
diff --git a/test/elided/signatures.txt b/test/elided/signatures.txt
index 3e6e5bd..3258611 100644
--- a/test/elided/signatures.txt
+++ b/test/elided/signatures.txt
@@ -24,3 +24,8 @@ Sent from my Windows 8 PC <http://windows.microsoft.com/consumer-preview>
 (sent from a phone)
 (Sent from mobile device)
 從我的 iPhone 傳送
+Sent from [mail](https://go.microsoft.com/fwlink/?LinkId=550986) for windows 10
+Verzonden met BlackBerry Work
+
+Get Outlook for iOShttps://aka.ms/o0ukef
+Get [Outlook for Android](https://aka.ms/ghei36)
diff --git a/test/elided/spam_1.txt b/test/elided/spam_1.txt
new file mode 100644
index 0000000..031d534
--- /dev/null
+++ b/test/elided/spam_1.txt
@@ -0,0 +1,75 @@
+> On Thu, Apr 30, 2020 at 10:07 AM, "someone" <someone@example.com> wrote:
+>
+>> On Thu, Apr 30, 2020 at 10:07 AM, "someone" <someone@example.com> wrote:
+>>
+>>> On Thu, Apr 30, 2020 at 10:07 AM, "someone" <someone@example.com> wrote:
+>>>
+>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>
+>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>
+>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>
+>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>
+>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>
+>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>
+>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>
+>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>
+>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>
+>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>
+>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
\ No newline at end of file
diff --git a/test/elided/spam_2.txt b/test/elided/spam_2.txt
new file mode 100644
index 0000000..421843b
--- /dev/null
+++ b/test/elided/spam_2.txt
@@ -0,0 +1,152 @@
+> On Thu, Apr 30, 2020 at 10:07 AM, "someone" <someone@example.com> wrote:
+>
+>> Hello world!
+>>
+>> On Thu, Apr 30, 2020 at 10:07 AM, "someone" <someone@example.com> wrote:
+>>
+>>> Hello world!
+>>>
+>>> On Thu, Apr 30, 2020 at 10:07 AM, "someone" <someone@example.com> wrote:
+>>>
+>>>> Hello world!
+>>>>
+>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>
+>>>>> Hello world!
+>>>>>
+>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>
+>>>>>> Hello world!
+>>>>>>
+>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>
+>>>>>>> Hello world!
+>>>>>>>
+>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>
+>>>>>>>> Hello world!
+>>>>>>>>
+>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>
+>>>>>>>>> Hello world!
+>>>>>>>>>
+>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>
+>>>>>>>>>> Hello world!
+>>>>>>>>>>
+>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>
+>>>>>>>>>>> Hello world!
+>>>>>>>>>>>
+>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>
+>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>
+>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>
+>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>
+>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>
+>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>
+>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
\ No newline at end of file
diff --git a/test/emails/email_headers_5.txt b/test/emails/email_headers_5.txt
new file mode 100644
index 0000000..fa23f19
--- /dev/null
+++ b/test/emails/email_headers_5.txt
@@ -0,0 +1,37 @@
+Hi Erlend,
+
+I don’t know what a “legally recognised educational institution” means for you.
+
+We’re based in Sweden and we provide education to our people across the globe.
+
+We want to try Discourse in small scale first to see it will add value to our communities.
+
+Best regards,
+
+//Jef
+
+
+
+From: Erlend Sogge Heggen <meta@discoursemail.com>
+Reply-To: Erlend Sogge Heggen <meta+abcd@discoursemail.com>
+Date: Wednesday, 5 April 2017 at 17:01
+To: Jef <jef@bar.com>
+Subject: [Discourse Meta] [PM] Discourse for Communities of Practice, educational organisation
+
+
+erlend_sh<https://meta.discourse.org/u/erlend_sh> Erlend Sogge Heggen<https://meta.discourse.org/u/erlend_sh> Team
+April 5
+
+
+
+Hi Jef,
+
+Is your University a legally recognised educational institution? Otherwise I'm afraid you're not eligible for this discount.
+
+Sincerely,
+
+Erlend
+
+
+
+This email message and any attachments may contain confidential information and may be privileged. If you are not the intended recipient or otherwise not authorized to receive this message, you are prohibited to use, copy, disclose or take any action based on this email or any information contained herein. If you are not the intended recipient, please advise the sender immediately by replying to this email and permanently delete this message and any attachments from your system.
diff --git a/test/emails/embedded_email_1.txt b/test/emails/embedded_email_1.txt
index 578ae4f..0fb1b82 100644
--- a/test/emails/embedded_email_1.txt
+++ b/test/emails/embedded_email_1.txt
@@ -2,7 +2,7 @@ This is before the embedded email.
 
 On Wed, Sep 25, 2013, at 03:57 PM, richard_clark wrote:
 
-> This is the embedded email
+Richard> This is the embedded email
 
 This is after the embedded email and will not show up because 99% of the times
 this is the signature...
diff --git a/test/emails/embedded_email_13.txt b/test/emails/embedded_email_13.txt
new file mode 100644
index 0000000..30b99ac
--- /dev/null
+++ b/test/emails/embedded_email_13.txt
@@ -0,0 +1,14 @@
+yes we're fine
+
+thanks
+
+
+At 6/16/2016 08:32 PM, you wrote:
+><https://meta.discourse.org/users/codinghorror>codinghorror
+><https://meta.discourse.org/users/codinghorror>Jeff Atwood co-founder
+>June 17
+>
+>Sorry I got a little mixed up with all the incoming replies. Are you
+>able to log in?
+>
+>Use your email address and "forgot password" if you need it reset.
diff --git a/test/emails/embedded_email_14.txt b/test/emails/embedded_email_14.txt
new file mode 100644
index 0000000..374a5ec
--- /dev/null
+++ b/test/emails/embedded_email_14.txt
@@ -0,0 +1,16 @@
+I just saw the standard plan has the slack integration.
+
+Thank you!
+
+2016-10-24 15:36 GMT+02:00 Foo bar <
+info@foo.bar>:
+
+> Thank you so much Erlend, very thanks!
+>
+> 2016-10-24 15:03 GMT+02:00 Erlend Sogge Heggen <meta@discoursemail.com>:
+>
+>> erlend_sh <https://meta.discourse.org/users/erlend_sh> Erlend Sogge
+>> Heggen <https://meta.discourse.org/users/erlend_sh> team
+>> October 24
+>>
+>> I received your application and I've replied with setup instructions.
diff --git a/test/emails/embedded_email_15.txt b/test/emails/embedded_email_15.txt
new file mode 100644
index 0000000..69196aa
--- /dev/null
+++ b/test/emails/embedded_email_15.txt
@@ -0,0 +1,9 @@
+[message body]
+
+/ Greetings
+
+2017-02-05 13:29 GMT+02:00 Very long author name <
+notifications@forum.some-discourse-host.local>:
+
+> [Original Messages is quoted here]
+> [...]
diff --git a/test/emails/embedded_email_16.txt b/test/emails/embedded_email_16.txt
new file mode 100644
index 0000000..2c9baa3
--- /dev/null
+++ b/test/emails/embedded_email_16.txt
@@ -0,0 +1,16 @@
+> From: "Albert Wagner" <alwagner@tcac.net>
+>
+> > Some guy at ibraheem@localhost(?) needs to be unsubscribed.  I
+> > keep getting bounces from his ISP everytime I post.  Surely,
+> > everyone else is getting the same?
+>
+> Surely it doesn't need to be said anymore, but I *still* am.
+> What's happening with this?
+
+Yep, me too, although I bet due to RubyConf/OOPSLA, it may be a little
+longer yet...
+
+--
+Eric Hodel - drbrain@segment7.net - http://segment7.net
+All messages signed with fingerprint:
+FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04
diff --git a/test/emails/embedded_email_17.txt b/test/emails/embedded_email_17.txt
new file mode 100644
index 0000000..ef4cf0b
--- /dev/null
+++ b/test/emails/embedded_email_17.txt
@@ -0,0 +1,38 @@
+On 15 May 2017 19:32, "Nomadic Sprite" <nomadic.sprite01@gmail.com> wrote:
+
+The intent was to return nil when the first value was nil.
+That was the op's issue.
+If one of the values was nil, she/he wanted nil.
+
+Nil && anything_else will always return nil, and I will not evaluate the
+second clause.
+
+On 8 May 2017 6:51 pm, "Andy Jones" <Andy.Jones@jameshall.co.uk> wrote:
+
+> >>>>>>>>
+> It should be:
+>     2.0 && 2.0 + 12.0
+> <<<<<<<<<
+>
+> Ah! Yes, that works.
+>
+>
+People are intent on not understanding, aren't they.
+
+    def nil_add_12 f
+      f && f + 12.0
+    end
+
+Generalised to two parameters:
+
+    def nil_add a, b
+      a && b && a + b
+    end
+
+The only quirk is the way they handle `false`.
+
+This is not tested, but it may be possible to do this, too:
+
+    f&.+ b
+
+Cheers
diff --git a/test/emails/embedded_email_18.txt b/test/emails/embedded_email_18.txt
new file mode 100644
index 0000000..f08c127
--- /dev/null
+++ b/test/emails/embedded_email_18.txt
@@ -0,0 +1,7 @@
+On 8 May 2017 17:34, "Andy Jones" <Andy.Jones@jameshall.co.uk> wrote:
+
+    nil && 2.0 + 12.0
+
+It should be:
+
+    2.0 && 2.0 + 12.0
diff --git a/test/emails/embedded_email_19.txt b/test/emails/embedded_email_19.txt
new file mode 100644
index 0000000..b197de8
--- /dev/null
+++ b/test/emails/embedded_email_19.txt
@@ -0,0 +1,13 @@
+I had a really hard time with the official guide, so when I finally
+figured it out, I wrote one of my own:
+
+
+http://ryanlue.com/posts/2017-02-18-how-to-publish-a-gem
+
+
+
+Let me know if you like it (or if you don't) – any feedback is highly
+appreciated!
+
+
+—Ryan
diff --git a/test/emails/embedded_email_4.txt b/test/emails/embedded_email_4.txt
index 39043b7..db3acf3 100644
--- a/test/emails/embedded_email_4.txt
+++ b/test/emails/embedded_email_4.txt
@@ -4,16 +4,16 @@ the page.
 
 2013/7/20 sam via Discourse Meta <info@discourse.org>
 
-> sam replied to your post in 'Unable to create group' on Discourse Meta:
-> ------------------------------
->
-> Is this an error handling thing, if you name the group "test" and only
-> place yourself in it, does it persist?
-> ------------------------------
->
-> To respond, reply to this email or visit
-> http://meta.discourse.org/t/unable-to-create-group/8198/6 in your browser.
->
-> To unsubscribe from these emails, visit your user preferences<http://meta.discourse.org/user_preferences>
-> .
->
+| sam replied to your post in 'Unable to create group' on Discourse Meta:
+| ------------------------------
+|
+| Is this an error handling thing, if you name the group "test" and only
+| place yourself in it, does it persist?
+| ------------------------------
+|
+| To respond, reply to this email or visit
+| http://meta.discourse.org/t/unable-to-create-group/8198/6 in your browser.
+|
+| To unsubscribe from these emails, visit your user preferences<http://meta.discourse.org/user_preferences>
+| .
+|
diff --git a/test/emails/embedded_email_7.txt b/test/emails/embedded_email_7.txt
index c62c3d6..73b2ae2 100644
--- a/test/emails/embedded_email_7.txt
+++ b/test/emails/embedded_email_7.txt
@@ -10,10 +10,10 @@ after the
 
 embedded email.
 
->
-> This is another part of the embedded email.
->
->
+C>
+C> This is another part of the embedded email.
+C>
+C>
 
 
 _______________________
diff --git a/test/emails/embedded_email_chinese.txt b/test/emails/embedded_email_chinese.txt
new file mode 100644
index 0000000..3cfccd6
--- /dev/null
+++ b/test/emails/embedded_email_chinese.txt
@@ -0,0 +1,7 @@
+Hi Erlend Sogge Heggen,
+Thank you for your reply.
+
+> 在 2016年12月12日,下午8:45,Erlend Sogge Heggen <meta@discoursemail.com> 写道:
+> fu.zhang:
+> Some random question
+>
diff --git a/test/emails/embedded_email_german_4.txt b/test/emails/embedded_email_german_4.txt
new file mode 100644
index 0000000..b28ee17
--- /dev/null
+++ b/test/emails/embedded_email_german_4.txt
@@ -0,0 +1,18 @@
+
+Hi there! I am replying from my german Google Inbox.
+
+Max Mustermann <try_discourse@discoursemail.com> schrieb am Fr., 28.
+Apr. 2017 um 11:53 Uhr:
+
+> max_2 <http://try.discourse.org/u/cfstras_2>
+> April 28
+
+> Hi there! you should be getting a mail.
+> ------------------------------
+
+> Visit Topic <http://try.discourse.org/t/this-is-my-internal-test/716/2>
+> or reply to this email to respond.
+
+> To unsubscribe from these emails, click here
+> <http://try.discourse.org/email/unsubscribe/badf00d>
+> .
diff --git a/test/emails/embedded_email_german_5.txt b/test/emails/embedded_email_german_5.txt
new file mode 100644
index 0000000..3b08279
--- /dev/null
+++ b/test/emails/embedded_email_german_5.txt
@@ -0,0 +1,23 @@
+Okay. Will give it a whirl.
+
+Erlend Sogge Heggen <meta@discoursemail.com> schrieb am Di., 16. Aug. 2016
+um 12:52 Uhr:
+
+> erlend_sh <https://meta.discourse.org/users/erlend_sh> Erlend Sogge Heggen
+> <https://meta.discourse.org/users/erlend_sh> team
+> August 16
+>
+> Hi Bob,
+>
+> Sure, it sounds like your requirements would fit our Standard plan. I
+> suggest you sign up for a free trial, as that will be the best way to see
+> for yourself if we support the kind of custom styling
+>
+> Sincerely,
+>
+> Erlend
+>
+--
+Viele Grüße / Best regards
+
+Bob
diff --git a/test/emails/embedded_email_german_6.txt b/test/emails/embedded_email_german_6.txt
new file mode 100644
index 0000000..8a1732e
--- /dev/null
+++ b/test/emails/embedded_email_german_6.txt
@@ -0,0 +1,14 @@
+Ich habe konzeptionell eine Präferenz für die zweite Option. Die 2 VLs
+stellen die Inhalte vor, und präsentieren diese in einen größeren Kontext.
+Dann beginnt das Training der technischen Finessen mit Trainingsblatt,
+Trainingsvideos usw. Bin gleichzeitig robust, sofern nötig.
+
+Am 21.04.2016 17:48 schrieb "Einz Zwei" <noreply@discourse.pseuco.com
+>:
+
+> einz.zwei <https://discourse.pseuco.com/users/einz.zwei> einz
+> zwei <https://discourse.pseuco.com/users/einz.zwei>
+> 21. April
+>
+> Vielleicht noch eine wichtige Frage:
+> Wann sollten wir diese Trainingsvideos veröffentlichen, es gibt 2
diff --git a/test/emails/embedded_email_norwegian.txt b/test/emails/embedded_email_norwegian.txt
new file mode 100644
index 0000000..2127425
--- /dev/null
+++ b/test/emails/embedded_email_norwegian.txt
@@ -0,0 +1,11 @@
+Thanx :-)
+
+Sendt fra min iPad
+
+Den 15. jun. 2016 kl. 20.42 skrev Jeff Atwood <info@discourse.org<mailto:info@discourse.org>>:
+
+        codinghorror<https://meta.discourse.org/users/codinghorror> Jeff Atwood<https://meta.discourse.org/users/codinghorror> co-founder
+June 15
+
+
+Enable tags in your admin, site settings.
diff --git a/test/emails/embedded_email_polish.txt b/test/emails/embedded_email_polish_1.txt
similarity index 100%
rename from test/emails/embedded_email_polish.txt
rename to test/emails/embedded_email_polish_1.txt
diff --git a/test/emails/embedded_email_polish_2.txt b/test/emails/embedded_email_polish_2.txt
new file mode 100644
index 0000000..f770f32
--- /dev/null
+++ b/test/emails/embedded_email_polish_2.txt
@@ -0,0 +1,11 @@
+Hi Neil,
+Thanks for prompt response!
+
+
+23 mar 2017 21:25 "Neil Lalonde" <meta@discoursemail.com> napisał(a):
+
+> neil <https://meta.discourse.org/users/neil> Neil Lalonde
+> <https://meta.discourse.org/users/neil> Team
+> March 23
+>
+> I have made required changes. Enjoy!
diff --git a/test/emails/embedded_email_russian.txt b/test/emails/embedded_email_russian_1.txt
similarity index 100%
rename from test/emails/embedded_email_russian.txt
rename to test/emails/embedded_email_russian_1.txt
diff --git a/test/emails/embedded_email_russian_2.txt b/test/emails/embedded_email_russian_2.txt
new file mode 100644
index 0000000..dbc32c1
--- /dev/null
+++ b/test/emails/embedded_email_russian_2.txt
@@ -0,0 +1,26 @@
+Yes.
+
+20 окт. 2016 г. 19:37 пользователь "Rafael dos Santos Silva" <
+meta@discoursemail.com> написал:
+
+> Falco <https://meta.discourse.org/users/falco> Rafael dos Santos Silva
+> <https://meta.discourse.org/users/falco> team
+> October 20
+>
+> Are you using our official docker install?
+>
+> If you are, try a rebuild:
+>
+> ssh root@server
+> cd /var/discourse
+> ./launcher rebuild app
+>
+> ------------------------------
+>
+> Visit Topic <https://meta.discourse.org/t/error-upgrading/51797/2> or
+> reply to this email to respond.
+>
+> To unsubscribe from these emails, click here
+> <https://meta.discourse.org/email/unsubscribe/184ce11578cd0abaddcb6e7460708971afed7278523347d3184a421229d87d08>
+> .
+>
diff --git a/test/emails/embedded_email_swedish.txt b/test/emails/embedded_email_swedish.txt
new file mode 100644
index 0000000..0bb885e
--- /dev/null
+++ b/test/emails/embedded_email_swedish.txt
@@ -0,0 +1,20 @@
+Hi everyone!
+
+Here you can find the pictures that I took https://foo.bar
+
+It was a pleasure to support this event.
+
+Best regards
+
+Some One
+
+
+
+Från: Foo Bar [mailto:noreply@foo.bar]
+Skickat: den 5 juni 2017 12:22
+Till: someone@domain.com
+Ämne: [WAT] Photos from the symposium
+
+If you have any pictures from any parts of the symposium that you are willing to share, please reply to this post to share them (you can simply copy and paste or drag'n'drop them into the text).
+
+Here are the group pictures we took on Wednesday after lunch.
diff --git a/test/emails/embedded_email_ukrainian.txt b/test/emails/embedded_email_ukrainian.txt
new file mode 100644
index 0000000..0317860
--- /dev/null
+++ b/test/emails/embedded_email_ukrainian.txt
@@ -0,0 +1,19 @@
+Спасибо еще раз.
+
+30 серп. 2016 р. 20:45 "Arpit" <no-reply@example.com> пише:
+
+> meg <http://forum.example.com/users/foo> Foo
+> <http://forum.example.com/users/foo>
+> Август 30
+>
+> Когда будет точное название, напишите в личку и мы поменяем название.
+> ------------------------------
+>
+> Visit Message
+> <http://forum.example.com/t/slug/24>
+> or reply to this email to respond.
+>
+> To unsubscribe from these emails, click here
+> <http://forum.example.com/email/unsubscribe/0123456789>
+> .
+>
diff --git a/test/emails/forwarded_apple.txt b/test/emails/forwarded_apple.txt
new file mode 100644
index 0000000..ae13e7d
--- /dev/null
+++ b/test/emails/forwarded_apple.txt
@@ -0,0 +1,17 @@
+This email has been forwarded from Apple Mail.
+
+> Begin forwarded message:
+>
+> From: Foo Discourse <foo@discourse.org>
+> Subject: This email is going to be forwarded
+> Date: 01 January 2019 at 12:00:00 EET
+> To: bar@discourse.org
+>
+> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi auctor
+> lacus in metus vehicula, non dictum mi consequat. Nunc eget quam sit
+> amet dolor scelerisque cursus. Etiam laoreet lectus a rutrum
+> sollicitudin. Nullam sit amet lorem id ante lobortis fringilla. Duis
+> dictum tempus sem et ultrices. Sed ac lectus ante. Vivamus interdum,
+> risus non tincidunt accumsan, purus mi accumsan dolor, vitae euismod
+> turpis orci ut est. Integer ut ante eu velit dignissim ullamcorper non
+> id nibh. Nulla auctor magna erat, et posuere sapien gravida convallis.
diff --git a/test/emails/forwarded_gmail.txt b/test/emails/forwarded_gmail.txt
new file mode 100644
index 0000000..9853fde
--- /dev/null
+++ b/test/emails/forwarded_gmail.txt
@@ -0,0 +1,17 @@
+This email has been forwarded from Gmail.
+
+---------- Forwarded message ---------
+From: Foo Discourse <foo@discourse.org>
+Date: Tue, Jan 01, 2019 at 12:00 PM
+Subject: This email is going to be forwarded
+To: <bar@discourse.org>
+
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi auctor
+lacus in metus vehicula, non dictum mi consequat. Nunc eget quam sit
+amet dolor scelerisque cursus. Etiam laoreet lectus a rutrum
+sollicitudin. Nullam sit amet lorem id ante lobortis fringilla. Duis
+dictum tempus sem et ultrices. Sed ac lectus ante. Vivamus interdum,
+risus non tincidunt accumsan, purus mi accumsan dolor, vitae euismod
+turpis orci ut est. Integer ut ante eu velit dignissim ullamcorper non
+id nibh. Nulla auctor magna erat, et posuere sapien gravida convallis.
diff --git a/test/emails/signatures.txt b/test/emails/signatures.txt
index 9252d49..09ea58b 100644
--- a/test/emails/signatures.txt
+++ b/test/emails/signatures.txt
@@ -26,3 +26,8 @@ Sent from my Windows 8 PC <http://windows.microsoft.com/consumer-preview>
 (sent from a phone)
 (Sent from mobile device)
 從我的 iPhone 傳送
+Sent from [mail](https://go.microsoft.com/fwlink/?LinkId=550986) for windows 10
+Verzonden met BlackBerry Work
+
+Get Outlook for iOShttps://aka.ms/o0ukef
+Get [Outlook for Android](https://aka.ms/ghei36)
diff --git a/test/emails/spam_1.txt b/test/emails/spam_1.txt
new file mode 100644
index 0000000..031d534
--- /dev/null
+++ b/test/emails/spam_1.txt
@@ -0,0 +1,75 @@
+> On Thu, Apr 30, 2020 at 10:07 AM, "someone" <someone@example.com> wrote:
+>
+>> On Thu, Apr 30, 2020 at 10:07 AM, "someone" <someone@example.com> wrote:
+>>
+>>> On Thu, Apr 30, 2020 at 10:07 AM, "someone" <someone@example.com> wrote:
+>>>
+>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>
+>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>
+>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>
+>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>
+>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>
+>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>
+>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>
+>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>
+>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>
+>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>
+>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
\ No newline at end of file
diff --git a/test/emails/spam_2.txt b/test/emails/spam_2.txt
new file mode 100644
index 0000000..5b36876
--- /dev/null
+++ b/test/emails/spam_2.txt
@@ -0,0 +1,174 @@
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sit amet dictum
+lectus, at efficitur neque. Class aptent taciti sociosqu ad litora torquent per
+conubia nostra, per inceptos himenaeos. Aenean dictum pulvinar tortor non
+ultricies. Maecenas cursus lobortis dolor quis feugiat. Integer efficitur,
+mauris sit amet lobortis consectetur, urna augue feugiat mi, et tempor dui
+sapien vehicula dolor. Aenean sit amet ultrices tortor. Praesent vel porttitor
+risus, eu fringilla nibh. Phasellus sollicitudin elit id tortor dapibus, at
+euismod odio sodales. Ut est ex, pharetra malesuada dui maximus, ullamcorper
+fringilla turpis. Nullam gravida, elit blandit commodo blandit, velit sem
+ornare odio, eu ultricies arcu ex sit amet libero. Vestibulum eu fringilla
+ante, nec blandit nunc.
+
+Nullam nec viverra ipsum. Nullam semper eu urna id facilisis. Nam blandit
+dictum eros, sit amet auctor dui fermentum a. Quisque finibus magna nisi, ac
+hendrerit purus lacinia ut. Donec maximus, enim id tincidunt vulputate, libero
+ex tempor elit, vitae sagittis libero leo sed leo. Quisque non gravida ex,
+efficitur interdum neque. Interdum et malesuada fames ac ante ipsum primis in
+faucibus. Phasellus rhoncus nisi vitae turpis bibendum luctus. Duis placerat
+aliquam lectus, pellentesque commodo dolor hendrerit quis. Suspendisse ipsum
+sapien, interdum ac felis ac, mattis varius neque. Maecenas nec risus sit amet
+ex aliquam vestibulum. Maecenas a turpis et turpis volutpat congue.
+
+> On Thu, Apr 30, 2020 at 10:07 AM, "someone" <someone@example.com> wrote:
+>
+>> Hello world!
+>>
+>> On Thu, Apr 30, 2020 at 10:07 AM, "someone" <someone@example.com> wrote:
+>>
+>>> Hello world!
+>>>
+>>> On Thu, Apr 30, 2020 at 10:07 AM, "someone" <someone@example.com> wrote:
+>>>
+>>>> Hello world!
+>>>>
+>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>
+>>>>> Hello world!
+>>>>>
+>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>
+>>>>>> Hello world!
+>>>>>>
+>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>
+>>>>>>> Hello world!
+>>>>>>>
+>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>
+>>>>>>>> Hello world!
+>>>>>>>>
+>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>
+>>>>>>>>> Hello world!
+>>>>>>>>>
+>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>
+>>>>>>>>>> Hello world!
+>>>>>>>>>>
+>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>
+>>>>>>>>>>> Hello world!
+>>>>>>>>>>>
+>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>
+>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>
+>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>
+>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>
+>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>
+>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>
+>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, Apr 30, 2020 at 10:06 AM, "someone" <someone@example.com> wrote:
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Hello world!
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
\ No newline at end of file
diff --git a/test/embedded/forwarded_apple.txt b/test/embedded/forwarded_apple.txt
new file mode 100644
index 0000000..7a4609b
--- /dev/null
+++ b/test/embedded/forwarded_apple.txt
@@ -0,0 +1,13 @@
+From: Foo Discourse <foo@discourse.org>
+Subject: This email is going to be forwarded
+Date: 01 January 2019 at 12:00:00 EET
+To: bar@discourse.org
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi auctor
+lacus in metus vehicula, non dictum mi consequat. Nunc eget quam sit
+amet dolor scelerisque cursus. Etiam laoreet lectus a rutrum
+sollicitudin. Nullam sit amet lorem id ante lobortis fringilla. Duis
+dictum tempus sem et ultrices. Sed ac lectus ante. Vivamus interdum,
+risus non tincidunt accumsan, purus mi accumsan dolor, vitae euismod
+turpis orci ut est. Integer ut ante eu velit dignissim ullamcorper non
+id nibh. Nulla auctor magna erat, et posuere sapien gravida convallis.
diff --git a/test/embedded/forwarded_gmail.txt b/test/embedded/forwarded_gmail.txt
new file mode 100644
index 0000000..1b44f7a
--- /dev/null
+++ b/test/embedded/forwarded_gmail.txt
@@ -0,0 +1,14 @@
+From: Foo Discourse <foo@discourse.org>
+Date: Tue, Jan 01, 2019 at 12:00 PM
+Subject: This email is going to be forwarded
+To: <bar@discourse.org>
+
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi auctor
+lacus in metus vehicula, non dictum mi consequat. Nunc eget quam sit
+amet dolor scelerisque cursus. Etiam laoreet lectus a rutrum
+sollicitudin. Nullam sit amet lorem id ante lobortis fringilla. Duis
+dictum tempus sem et ultrices. Sed ac lectus ante. Vivamus interdum,
+risus non tincidunt accumsan, purus mi accumsan dolor, vitae euismod
+turpis orci ut est. Integer ut ante eu velit dignissim ullamcorper non
+id nibh. Nulla auctor magna erat, et posuere sapien gravida convallis.
diff --git a/test/matchers/does_not_contain_embedded_email.txt b/test/matchers/does_not_contain_embedded_email.txt
new file mode 100644
index 0000000..b544c7d
--- /dev/null
+++ b/test/matchers/does_not_contain_embedded_email.txt
@@ -0,0 +1,5 @@
+> am 09.09.2017 um 21:42 sssssss
+ßßßßßßßß fffffff
+
+> in message from sssssss
+ßßßßßßßß fffffff
\ No newline at end of file
diff --git a/test/test_email_matcher.rb b/test/test_email_matcher.rb
new file mode 100644
index 0000000..e297375
--- /dev/null
+++ b/test/test_email_matcher.rb
@@ -0,0 +1,15 @@
+require "minitest/autorun"
+require "email_reply_trimmer"
+require "timeout"
+
+class TestEmailReplyTrimmer < Minitest::Test
+  def test_does_not_hang_when_no_embedded_email_is_found
+    Timeout.timeout(5) do
+      EmbeddedEmailMatcher.match?(example("does_not_contain_embedded_email.txt"))
+    end
+  end
+
+  def example(filename)
+    File.read("test/matchers/#{filename}").strip
+  end
+end
diff --git a/test/test_email_reply_trimmer.rb b/test/test_email_reply_trimmer.rb
index fe51b56..c901bee 100644
--- a/test/test_email_reply_trimmer.rb
+++ b/test/test_email_reply_trimmer.rb
@@ -19,18 +19,22 @@ class TestEmailReplyTrimmer < Minitest::Test
     assert_match(/\r\n/, File.read("test/emails/normalize_line_endings.txt"))
   end
 
+  def test_is_reply_at_end?
+    Timeout::timeout(1) { assert_nil(EmailReplyTrimmer.send(:is_reply_at_end?, "bq" * 100)) }
+  end
+
   EMAILS.each do |filename|
     name = File.basename(filename, ".txt")
     define_method("test_#{name}") do
-      assert_equal(trim(filename), trimmed(filename), "[TRIMMED] EMAIL: #{filename}")
-      assert_equal(elide(filename), elided(filename), "[ELIDED] EMAIL: #{filename}")
+      assert_equal(trimmed(filename), trim(filename), "[TRIMMED] EMAIL: #{filename}")
+      assert_equal(elided(filename), elide(filename), "[ELIDED] EMAIL: #{filename}")
     end
   end
 
   EMBEDDED_EMAILS = %w{
     email_headers_1 email_headers_2 email_headers_3 email_headers_4
     embedded_email_10 embedded_email_german_3 embedded_email_spanish_2
-    forwarded_message
+    forwarded_message forwarded_gmail forwarded_apple
   }
 
   EMBEDDED_EMAILS.each do |name|
diff --git a/test/trimmed/email_headers_5.txt b/test/trimmed/email_headers_5.txt
new file mode 100644
index 0000000..498e66e
--- /dev/null
+++ b/test/trimmed/email_headers_5.txt
@@ -0,0 +1,11 @@
+Hi Erlend,
+
+I don’t know what a “legally recognised educational institution” means for you.
+
+We’re based in Sweden and we provide education to our people across the globe.
+
+We want to try Discourse in small scale first to see it will add value to our communities.
+
+Best regards,
+
+//Jef
diff --git a/test/trimmed/embedded_email_13.txt b/test/trimmed/embedded_email_13.txt
new file mode 100644
index 0000000..d8fadc1
--- /dev/null
+++ b/test/trimmed/embedded_email_13.txt
@@ -0,0 +1,3 @@
+yes we're fine
+
+thanks
diff --git a/test/trimmed/embedded_email_14.txt b/test/trimmed/embedded_email_14.txt
new file mode 100644
index 0000000..ab23684
--- /dev/null
+++ b/test/trimmed/embedded_email_14.txt
@@ -0,0 +1,3 @@
+I just saw the standard plan has the slack integration.
+
+Thank you!
diff --git a/test/trimmed/embedded_email_15.txt b/test/trimmed/embedded_email_15.txt
new file mode 100644
index 0000000..742c20e
--- /dev/null
+++ b/test/trimmed/embedded_email_15.txt
@@ -0,0 +1,3 @@
+[message body]
+
+/ Greetings
diff --git a/test/trimmed/embedded_email_16.txt b/test/trimmed/embedded_email_16.txt
new file mode 100644
index 0000000..48f520d
--- /dev/null
+++ b/test/trimmed/embedded_email_16.txt
@@ -0,0 +1,11 @@
+> From: "Albert Wagner" <alwagner@tcac.net>
+>
+> > Some guy at ibraheem@localhost(?) needs to be unsubscribed.  I
+> > keep getting bounces from his ISP everytime I post.  Surely,
+> > everyone else is getting the same?
+>
+> Surely it doesn't need to be said anymore, but I *still* am.
+> What's happening with this?
+
+Yep, me too, although I bet due to RubyConf/OOPSLA, it may be a little
+longer yet...
diff --git a/test/trimmed/embedded_email_17.txt b/test/trimmed/embedded_email_17.txt
new file mode 100644
index 0000000..9be8a3f
--- /dev/null
+++ b/test/trimmed/embedded_email_17.txt
@@ -0,0 +1,35 @@
+The intent was to return nil when the first value was nil.
+That was the op's issue.
+If one of the values was nil, she/he wanted nil.
+
+Nil && anything_else will always return nil, and I will not evaluate the
+second clause.
+
+
+> >>>>>>>>
+> It should be:
+>     2.0 && 2.0 + 12.0
+> <<<<<<<<<
+>
+> Ah! Yes, that works.
+>
+>
+People are intent on not understanding, aren't they.
+
+    def nil_add_12 f
+      f && f + 12.0
+    end
+
+Generalised to two parameters:
+
+    def nil_add a, b
+      a && b && a + b
+    end
+
+The only quirk is the way they handle `false`.
+
+This is not tested, but it may be possible to do this, too:
+
+    f&.+ b
+
+Cheers
diff --git a/test/trimmed/embedded_email_18.txt b/test/trimmed/embedded_email_18.txt
new file mode 100644
index 0000000..3aef924
--- /dev/null
+++ b/test/trimmed/embedded_email_18.txt
@@ -0,0 +1,5 @@
+    nil && 2.0 + 12.0
+
+It should be:
+
+    2.0 && 2.0 + 12.0
diff --git a/test/trimmed/embedded_email_19.txt b/test/trimmed/embedded_email_19.txt
new file mode 100644
index 0000000..b197de8
--- /dev/null
+++ b/test/trimmed/embedded_email_19.txt
@@ -0,0 +1,13 @@
+I had a really hard time with the official guide, so when I finally
+figured it out, I wrote one of my own:
+
+
+http://ryanlue.com/posts/2017-02-18-how-to-publish-a-gem
+
+
+
+Let me know if you like it (or if you don't) – any feedback is highly
+appreciated!
+
+
+—Ryan
diff --git a/test/trimmed/embedded_email_chinese.txt b/test/trimmed/embedded_email_chinese.txt
new file mode 100644
index 0000000..337e844
--- /dev/null
+++ b/test/trimmed/embedded_email_chinese.txt
@@ -0,0 +1,2 @@
+Hi Erlend Sogge Heggen,
+Thank you for your reply.
diff --git a/test/trimmed/embedded_email_german_4.txt b/test/trimmed/embedded_email_german_4.txt
new file mode 100644
index 0000000..fb81a63
--- /dev/null
+++ b/test/trimmed/embedded_email_german_4.txt
@@ -0,0 +1 @@
+Hi there! I am replying from my german Google Inbox.
diff --git a/test/trimmed/embedded_email_german_5.txt b/test/trimmed/embedded_email_german_5.txt
new file mode 100644
index 0000000..2035809
--- /dev/null
+++ b/test/trimmed/embedded_email_german_5.txt
@@ -0,0 +1 @@
+Okay. Will give it a whirl.
diff --git a/test/trimmed/embedded_email_german_6.txt b/test/trimmed/embedded_email_german_6.txt
new file mode 100644
index 0000000..6b957af
--- /dev/null
+++ b/test/trimmed/embedded_email_german_6.txt
@@ -0,0 +1,4 @@
+Ich habe konzeptionell eine Präferenz für die zweite Option. Die 2 VLs
+stellen die Inhalte vor, und präsentieren diese in einen größeren Kontext.
+Dann beginnt das Training der technischen Finessen mit Trainingsblatt,
+Trainingsvideos usw. Bin gleichzeitig robust, sofern nötig.
diff --git a/test/trimmed/embedded_email_norwegian.txt b/test/trimmed/embedded_email_norwegian.txt
new file mode 100644
index 0000000..69608f0
--- /dev/null
+++ b/test/trimmed/embedded_email_norwegian.txt
@@ -0,0 +1 @@
+Thanx :-)
diff --git a/test/trimmed/embedded_email_polish.txt b/test/trimmed/embedded_email_polish_1.txt
similarity index 100%
rename from test/trimmed/embedded_email_polish.txt
rename to test/trimmed/embedded_email_polish_1.txt
diff --git a/test/trimmed/embedded_email_polish_2.txt b/test/trimmed/embedded_email_polish_2.txt
new file mode 100644
index 0000000..48470a6
--- /dev/null
+++ b/test/trimmed/embedded_email_polish_2.txt
@@ -0,0 +1,2 @@
+Hi Neil,
+Thanks for prompt response!
diff --git a/test/trimmed/embedded_email_quote_text.txt b/test/trimmed/embedded_email_quote_text.txt
index 41220f2..2919c72 100644
--- a/test/trimmed/embedded_email_quote_text.txt
+++ b/test/trimmed/embedded_email_quote_text.txt
@@ -1,7 +1,2 @@
-> This seems like a problem that would be better solved at the web server
-> level, rather than by the application. If nothing else, adding an instance
-> of Nginx as an SSL/TLS reverse-proxy would very quickly take care of this.
->
-
 when I said looks possible, I pointed to rack because that's still the web
 server level
diff --git a/test/trimmed/embedded_email_russian.txt b/test/trimmed/embedded_email_russian_1.txt
similarity index 100%
rename from test/trimmed/embedded_email_russian.txt
rename to test/trimmed/embedded_email_russian_1.txt
diff --git a/test/trimmed/embedded_email_russian_2.txt b/test/trimmed/embedded_email_russian_2.txt
new file mode 100644
index 0000000..d0235a9
--- /dev/null
+++ b/test/trimmed/embedded_email_russian_2.txt
@@ -0,0 +1 @@
+Yes.
diff --git a/test/trimmed/embedded_email_swedish.txt b/test/trimmed/embedded_email_swedish.txt
new file mode 100644
index 0000000..532db75
--- /dev/null
+++ b/test/trimmed/embedded_email_swedish.txt
@@ -0,0 +1,9 @@
+Hi everyone!
+
+Here you can find the pictures that I took https://foo.bar
+
+It was a pleasure to support this event.
+
+Best regards
+
+Some One
diff --git a/test/trimmed/embedded_email_ukrainian.txt b/test/trimmed/embedded_email_ukrainian.txt
new file mode 100644
index 0000000..8ea68cd
--- /dev/null
+++ b/test/trimmed/embedded_email_ukrainian.txt
@@ -0,0 +1 @@
+Спасибо еще раз.
diff --git a/test/trimmed/forwarded_apple.txt b/test/trimmed/forwarded_apple.txt
new file mode 100644
index 0000000..e8c173f
--- /dev/null
+++ b/test/trimmed/forwarded_apple.txt
@@ -0,0 +1 @@
+This email has been forwarded from Apple Mail.
diff --git a/test/trimmed/forwarded_gmail.txt b/test/trimmed/forwarded_gmail.txt
new file mode 100644
index 0000000..fd75a53
--- /dev/null
+++ b/test/trimmed/forwarded_gmail.txt
@@ -0,0 +1 @@
+This email has been forwarded from Gmail.
diff --git a/test/trimmed/spam_1.txt b/test/trimmed/spam_1.txt
new file mode 100644
index 0000000..e69de29
diff --git a/test/trimmed/spam_2.txt b/test/trimmed/spam_2.txt
new file mode 100644
index 0000000..305c6ce
--- /dev/null
+++ b/test/trimmed/spam_2.txt
@@ -0,0 +1,21 @@
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sit amet dictum
+lectus, at efficitur neque. Class aptent taciti sociosqu ad litora torquent per
+conubia nostra, per inceptos himenaeos. Aenean dictum pulvinar tortor non
+ultricies. Maecenas cursus lobortis dolor quis feugiat. Integer efficitur,
+mauris sit amet lobortis consectetur, urna augue feugiat mi, et tempor dui
+sapien vehicula dolor. Aenean sit amet ultrices tortor. Praesent vel porttitor
+risus, eu fringilla nibh. Phasellus sollicitudin elit id tortor dapibus, at
+euismod odio sodales. Ut est ex, pharetra malesuada dui maximus, ullamcorper
+fringilla turpis. Nullam gravida, elit blandit commodo blandit, velit sem
+ornare odio, eu ultricies arcu ex sit amet libero. Vestibulum eu fringilla
+ante, nec blandit nunc.
+
+Nullam nec viverra ipsum. Nullam semper eu urna id facilisis. Nam blandit
+dictum eros, sit amet auctor dui fermentum a. Quisque finibus magna nisi, ac
+hendrerit purus lacinia ut. Donec maximus, enim id tincidunt vulputate, libero
+ex tempor elit, vitae sagittis libero leo sed leo. Quisque non gravida ex,
+efficitur interdum neque. Interdum et malesuada fames ac ante ipsum primis in
+faucibus. Phasellus rhoncus nisi vitae turpis bibendum luctus. Duis placerat
+aliquam lectus, pellentesque commodo dolor hendrerit quis. Suspendisse ipsum
+sapien, interdum ac felis ac, mattis varius neque. Maecenas nec risus sit amet
+ex aliquam vestibulum. Maecenas a turpis et turpis volutpat congue.
\ No newline at end of file

Debdiff

[The following lists of changes regard files as different if they have different names, permissions or owners.]

Files in second set of .debs but not in first

-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/email_reply_trimmer-0.1.13/lib/email_reply_trimmer.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/email_reply_trimmer-0.1.13/lib/email_reply_trimmer/delimiter_matcher.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/email_reply_trimmer-0.1.13/lib/email_reply_trimmer/email_header_matcher.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/email_reply_trimmer-0.1.13/lib/email_reply_trimmer/embedded_email_matcher.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/email_reply_trimmer-0.1.13/lib/email_reply_trimmer/empty_line_matcher.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/email_reply_trimmer-0.1.13/lib/email_reply_trimmer/quote_matcher.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/email_reply_trimmer-0.1.13/lib/email_reply_trimmer/signature_matcher.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/specifications/email_reply_trimmer-0.1.13.gemspec

Files in first set of .debs but not in second

-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/email_reply_trimmer-0.1.6/lib/email_reply_trimmer.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/email_reply_trimmer-0.1.6/lib/email_reply_trimmer/delimiter_matcher.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/email_reply_trimmer-0.1.6/lib/email_reply_trimmer/email_header_matcher.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/email_reply_trimmer-0.1.6/lib/email_reply_trimmer/embedded_email_matcher.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/email_reply_trimmer-0.1.6/lib/email_reply_trimmer/empty_line_matcher.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/email_reply_trimmer-0.1.6/lib/email_reply_trimmer/quote_matcher.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/email_reply_trimmer-0.1.6/lib/email_reply_trimmer/signature_matcher.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/specifications/email_reply_trimmer-0.1.6.gemspec

No differences were encountered in the control files

More details

Full run details