diff --git a/spec/fixtures/emails/email_19.html b/spec/fixtures/emails/email_19.html
new file mode 100644
index 000000000..178fee660
--- /dev/null
+++ b/spec/fixtures/emails/email_19.html
@@ -0,0 +1,80 @@
+
+
+
+
+
+and again
+
+Sent from
+Nylas N1, the extensible, open source mail client.
+
+On Nov 4 2016, at 2:28 pm, Juan Tejada <juan@nylas.com> wrote:
+
+hey evan sorry to spam you so much
+
+Sent from
+Nylas N1, the extensible, open source mail client.
+
+On Nov 4 2016, at 2:20 pm, Juan Tejada <juan@nylas.com> wrote:
+
+wat
+
+Sent from
+Nylas N1, the extensible, open source mail client.
+
+On Nov 4 2016, at 1:19 pm, Juan Tejada <juan@nylas.com> wrote:
+
+this should only happen once
+
+Sent from
+Nylas N1, the extensible, open source mail client.
+
+On Nov 4 2016, at 1:13 pm, Juan Tejada <juan@nylas.com> wrote:
+
+and again
+
+Sent from
+Nylas N1, the extensible, open source mail client.
+
+On Nov 4 2016, at 1:13 pm, Juan Tejada <juan@nylas.com> wrote:
+
+and some other stuff
+
+Sent from Nylas N1, the exten=
+sible, open source mail client.
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spec/fixtures/emails/email_19_stripped.html b/spec/fixtures/emails/email_19_stripped.html
new file mode 100644
index 000000000..12d8da810
--- /dev/null
+++ b/spec/fixtures/emails/email_19_stripped.html
@@ -0,0 +1,14 @@
+
+
+
+
+and again
+
+Sent from
+Nylas N1, the extensible, open source mail client.
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spec/services/quoted-html-transformer-spec.coffee b/spec/services/quoted-html-transformer-spec.coffee
index 61beaefd4..8fe3d52d2 100644
--- a/spec/services/quoted-html-transformer-spec.coffee
+++ b/spec/services/quoted-html-transformer-spec.coffee
@@ -19,7 +19,7 @@ describe "QuotedHTMLTransformer", ->
re = new RegExp(QuotedHTMLTransformer.annotationClass, 'g')
html.match(re)?.length ? 0
- [1..18].forEach (n) ->
+ [1..19].forEach (n) ->
it "properly parses email_#{n}", ->
opts = keepIfWholeBodyIsQuote: true
expect(removeQuotedHTML("email_#{n}.html", opts).trim()).toEqual(readFile("email_#{n}_stripped.html").trim())
@@ -405,7 +405,7 @@ describe "QuotedHTMLTransformer", ->
# `QuotedHTMLTransformer` needs Electron booted up in order to work because
# of the DOMParser.
xit "Run this simple function to generate output files", ->
- [18].forEach (n) ->
+ [19..20].forEach (n) ->
newHTML = QuotedHTMLTransformer.removeQuotedHTML(readFile("email_#{n}.html"))
outPath = path.resolve(__dirname, '..', 'fixtures', 'emails', "email_#{n}_raw_stripped.html")
fs.writeFileSync(outPath, newHTML)
diff --git a/src/services/quote-string-detector.es6 b/src/services/quote-string-detector.es6
index 720952f91..7bca15ece 100644
--- a/src/services/quote-string-detector.es6
+++ b/src/services/quote-string-detector.es6
@@ -17,7 +17,7 @@ export default function quoteStringDetector(doc) {
for (const node of DOMWalkers.walkBackwards(doc)) {
if (node.nodeType === Node.TEXT_NODE && node.nodeValue.trim().length > 0) {
if (!seenInitialQuoteEnd) {
- if (/wrote:$/gim.test(node.nodeValue)) {
+ if (/wrote:\s*$/gim.test(node.nodeValue)) {
seenInitialQuoteEnd = true;
quoteNodesToRemove.push(node);
if (/On \S/gim.test(node.nodeValue)) {