mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-12 12:40:08 +08:00
a23c68092e
Summary: This commit also fixes snippets for HTML-only messages to strip out HTML tags, and makes us preserve whitespace for plaintext emails by displaying them in <pre class="nylas-plaintext"> tags, and makes us log messages that fail to parse at all to a tempdir. The only issue I found with using <pre> tags for plaintext email was that some lines may trigger scrolling, so there is an associated commit (D3484) that changes the CSS for <pre class="nylas-plaintext"> to wrap lines. In the future, we can add regression tests to this test suite whenever we fix parsing bugs. Test Plan: unit tests included Reviewers: bengotow Reviewed By: bengotow Differential Revision: https://phab.nylas.com/D3483
1 line
No EOL
7 KiB
JSON
1 line
No EOL
7 KiB
JSON
{"imapMessage":{"attributes":{"struct":[{"partID":"1","type":"text","subtype":"html","params":{"charset":"utf-8"},"id":null,"description":null,"encoding":"BASE64","size":1318,"lines":19,"md5":null,"disposition":null,"language":null}],"date":"2016-12-05T22:09:12.000Z","flags":[],"uid":6466,"modseq":"8251529","x-gm-labels":[],"x-gm-msgid":"1552915630214378399","x-gm-thrid":"1552915630214378399"},"headers":"Delivered-To: christine@spang.cc\r\nReceived: by 10.140.100.181 with SMTP id s50csp1710867qge; Mon, 5 Dec 2016\r\n 14:09:12 -0800 (PST)\r\nX-Received: by 10.129.97.134 with SMTP id v128mr54944350ywb.338.1480975752135;\r\n Mon, 05 Dec 2016 14:09:12 -0800 (PST)\r\nReturn-Path: <cfvqtub@rapab.com>\r\nReceived: from muffat.debian.org (muffat.debian.org.\r\n [2607:f8f0:614:1::1274:33]) by mx.google.com with ESMTPS id\r\n w195si4900468ywd.160.2016.12.05.14.09.11 for <christine@spang.cc>\r\n (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Dec\r\n 2016 14:09:12 -0800 (PST)\r\nReceived-SPF: neutral (google.com: 2607:f8f0:614:1::1274:33 is neither\r\n permitted nor denied by best guess record for domain of cfvqtub@rapab.com)\r\n client-ip=2607:f8f0:614:1::1274:33;\r\nAuthentication-Results: mx.google.com; spf=neutral (google.com:\r\n 2607:f8f0:614:1::1274:33 is neither permitted nor denied by best guess record\r\n for domain of cfvqtub@rapab.com) smtp.mailfrom=cfvqtub@rapab.com\r\nMessage-Id: <5845e588.ccd40d0a.ea741.b529SMTPIN_ADDED_MISSING@mx.google.com>\r\nReceived: from [180.127.164.182] (helo=rapab.com) by muffat.debian.org with\r\n esmtp (Exim 4.84_2) (envelope-from <cfvqtub@rapab.com>) id 1cE1Re-0002e1-KR\r\n for christine@spang.cc; Mon, 05 Dec 2016 22:09:11 +0000\r\nReceived: from vps5754 ([127.0.0.1]) by localhost via TCP with ESMTPA; Tue, 06\r\n Dec 2016 06:08:54 +0800\r\nMIME-Version: 1.0\r\nFrom: Peggy <yanmusinei55@163.com>\r\nSender: Peggy <cfvqtub@rapab.com>\r\nTo: christine@debian.org\r\nReply-To: Peggy <yanmusinei55@163.com>\r\nDate: 6 Dec 2016 06:08:54 +0800\r\nSubject: =?utf-8?B?VGhlIEJlc3QgT2ZmZXIgb2YgbGFueWFyZHM=?=\r\nContent-Type: text/html; charset=utf-8\r\nContent-Transfer-Encoding: base64\r\n\r\n","parts":{"1":"PGh0bWw+PGJvZHk+PFA+RGVhciBmcmllbmQsPC9QPg0KPFA+VGhhbmsgeW91IGZvciB5b3Vy\r\nIGF0dGVudGlvbi4gPC9QPg0KPFA+T3VyIGNvbXBhbnkgaXMgYSBvbmUtc3RvcCBsYW55YXJk\r\ncyBmYWN0b3J5ICwgcHJvdmlkaW5nIHByaW50aW5nIGFuZCBkaXN0cmlidXRpbmcgc2Vydmlj\r\nZSB0byBjdXN0b21lcnMgYXJvdW5kIHRoZSB3b3JsZC48L1A+DQo8UD5NYWluIHByb2R1Y3Rz\r\nIGFyZSBzaWxrIHByaW50IC9oZWF0IHRyYW5zZmVycmVkIC8gc2F0aW4gbGFjZSBvbiByaWJi\r\nb24vIHdvdmVuIGxhbnlhcmRzLCZuYnNwOyBsaWdodCB1cCBsYW55YXJkcywgYm90dGxlIGhv\r\nbGRlcnMsIFVTQiB3cmlzdGJhbmRzLCBsYW55YXJkIHdpdGggd2F0ZXJwcm9vZiByYWluIGhh\r\ndCwgYm90dGxlIG9wZW5lcnMsa2V5IGNoYWlucywgY2FyYWJpbmVycywgc2hvZXNsYWNlcywg\r\nbHVnZ2FnZSBiZWx0cywgSUQgY2FyZCBob2xkZXJzLG1vYmlsZSBwaG9uZSBzdHJhcHMsIG5l\r\nY2tzdHJhcHMuZXRjLjwvUD4NCjxQPkFsbCBwcm9kdWN0cyBhcmUgY3VzdG9taXplZC4gTm8g\r\ncHJpY2UgbGlzdC4gSWYgeW91IG5lZWQgcXVvdGF0aW9uLCBwbGVhc2UgbGV0IG1lIGtub3cg\r\ndGhlIHNwZWNpZmljYXRpb25zLjwvUD4NCjxQPldlIGNhbiBtYWtlIGFzIHBlciB5b3VyIGRl\r\nc2lnbiBhbmQgeW91ciBsb2dvLjwvUD4NCjxQPk5vIE1PUSBzZXJ2aWNlPC9QPg0KPFA+RGVz\r\naWduZXIgU2VydmljZTwvUD4NCjxQPlBNUyBleHByZXNzIHNlcnZpY2U8L1A+DQo8UD5JdCB3\r\naWxsIGJlIGdyZWF0IGlmIHlvdSBjb3VsZCBzZW5kIG1lIGZpbGUgb3IgcGljdHVyZSBmb3Ig\r\ncmVmZXJlbmNlLjwvUD4NCjxQPkJlc3QgUmVnYXJkcyw8L1A+DQo8UD5QZWdneTxCUj5Nb2I6\r\nODYtMTg4IDI1NTQgNTg0NjxCUj5BREQ6Q2hhbmcgQW4gVG93bixEb25nZ3VhbiBDaXR5IEd1\r\nYW5kb25nIFByb3ZpbmNlLCBDaGluYTwvUD48L2JvZHk+PC9odG1sPg==\r\n\r\n"}},"desiredParts":[{"id":"1","encoding":"BASE64","mimetype":"text/html"}],"result":{"id":"9c81f13eb472b193dcd8ac571e77c5881d9d31c8d13e710eb7f394e735ef0f64","to":[{"name":"","email":"christine@debian.org"}],"cc":[],"bcc":[],"from":[{"name":"Peggy","email":"yanmusinei55@163.com"}],"replyTo":[{"name":"Peggy","email":"yanmusinei55@163.com"}],"accountId":"test-account-id","body":"<html><body><P>Dear friend,</P>\r\n<P>Thank you for your attention. </P>\r\n<P>Our company is a one-stop lanyards factory , providing printing and distributing service to customers around the world.</P>\r\n<P>Main products are silk print /heat transferred / satin lace on ribbon/ woven lanyards, light up lanyards, bottle holders, USB wristbands, lanyard with waterproof rain hat, bottle openers,key chains, carabiners, shoeslaces, luggage belts, ID card holders,mobile phone straps, neckstraps.etc.</P>\r\n<P>All products are customized. No price list. If you need quotation, please let me know the specifications.</P>\r\n<P>We can make as per your design and your logo.</P>\r\n<P>No MOQ service</P>\r\n<P>Designer Service</P>\r\n<P>PMS express service</P>\r\n<P>It will be great if you could send me file or picture for reference.</P>\r\n<P>Best Regards,</P>\r\n<P>Peggy<BR>Mob:86-188 2554 5846<BR>ADD:Chang An Town,Dongguan City Guandong Province, China</P></body></html>","snippet":"Dear friend,\r\nThank you for your attention. \r\nOur company is a one-stop lanyards factory , providing","unread":true,"starred":false,"date":"2016-12-05T22:09:12.000Z","folderImapUID":6466,"folderId":"test-folder-id","folder":{"id":"test-folder-id","account_id":"test-account-id","object":"folder","name":null,"display_name":"Test Folder"},"labels":[],"headers":{"delivered-to":["christine@spang.cc"],"received":["by 10.140.100.181 with SMTP id s50csp1710867qge; Mon, 5 Dec 2016 14:09:12 -0800 (PST)","from muffat.debian.org (muffat.debian.org. [2607:f8f0:614:1::1274:33]) by mx.google.com with ESMTPS id w195si4900468ywd.160.2016.12.05.14.09.11 for <christine@spang.cc> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Dec 2016 14:09:12 -0800 (PST)","from [180.127.164.182] (helo=rapab.com) by muffat.debian.org with esmtp (Exim 4.84_2) (envelope-from <cfvqtub@rapab.com>) id 1cE1Re-0002e1-KR for christine@spang.cc; Mon, 05 Dec 2016 22:09:11 +0000","from vps5754 ([127.0.0.1]) by localhost via TCP with ESMTPA; Tue, 06 Dec 2016 06:08:54 +0800"],"x-received":["by 10.129.97.134 with SMTP id v128mr54944350ywb.338.1480975752135; Mon, 05 Dec 2016 14:09:12 -0800 (PST)"],"return-path":["<cfvqtub@rapab.com>"],"received-spf":["neutral (google.com: 2607:f8f0:614:1::1274:33 is neither permitted nor denied by best guess record for domain of cfvqtub@rapab.com) client-ip=2607:f8f0:614:1::1274:33;"],"authentication-results":["mx.google.com; spf=neutral (google.com: 2607:f8f0:614:1::1274:33 is neither permitted nor denied by best guess record for domain of cfvqtub@rapab.com) smtp.mailfrom=cfvqtub@rapab.com"],"message-id":["<5845e588.ccd40d0a.ea741.b529SMTPIN_ADDED_MISSING@mx.google.com>"],"mime-version":["1.0"],"from":["Peggy <yanmusinei55@163.com>"],"sender":["Peggy <cfvqtub@rapab.com>"],"to":["christine@debian.org"],"reply-to":["Peggy <yanmusinei55@163.com>"],"date":["6 Dec 2016 06:08:54 +0800"],"subject":["The Best Offer of lanyards"],"content-type":["text/html; charset=utf-8"],"content-transfer-encoding":["base64"],"x-gm-thrid":"1552915630214378399","x-gm-msgid":"1552915630214378399","x-gm-labels":[]},"headerMessageId":"<5845e588.ccd40d0a.ea741.b529SMTPIN_ADDED_MISSING@mx.google.com>","subject":"The Best Offer of lanyards","folderImapXGMLabels":"[]"}} |