bounce_email 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 55954008bef2210a6460404c920ccce94fdc4ae1
4
- data.tar.gz: 1bd0ac6c90c0996cb20e10e32fa76f644cc6d01e
3
+ metadata.gz: c78d63fcf13d9a6ff01002e733528e625c5711a0
4
+ data.tar.gz: 5ca361001d0929091f392ec47971b542f77e5c62
5
5
  SHA512:
6
- metadata.gz: afd0999f0c9f8f2fdf0685cc37492f5fa7c9655959fe81f9206f63ff3c06256860515203182bdbe0329dd774fd82e01f72f97568170b6d5c58a35b51710ab493
7
- data.tar.gz: 8512ba0070b9110e4b4c16e977be338479ec63ef62ade88431dbf299fd3432262df9fc3f74aa69a3323dd4f6bd2b2749921f882ed858b9a1ea7743b9cf433786
6
+ metadata.gz: d451617b7f643007b672821870aa53afad12c1e1ff74b988363b86aed857fed34c732321975014e02a979d808d59a163d071eade8d1ff0569b23060ccbc9ff75
7
+ data.tar.gz: c6c50ac546c1318e232facda201ef94f82cd5658688feb31ec758fd404b726fe1f98747372fd5f4a3b9dd3166b2b79a81aa6d40570d58b83f0ab33eb9395a12d
data/HISTORY.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.2.5
2
+
3
+ * Fix parsing of original mail (@saghaulor, livebg/bounce_email#6)
4
+
1
5
  ## 0.2.4
2
6
 
3
7
  * Parse and reassign message-ID, to, from, and subject from original mail
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.2.5
data/lib/bounce_email.rb CHANGED
@@ -237,7 +237,8 @@ module BounceEmail
237
237
  def extract_original_message_after_delimiter(mail, delimiter_index)
238
238
  delimiter = INLINE_MESSAGE_BEGIN_DELIMITERS[delimiter_index]
239
239
  message = mail.body.to_s.split(delimiter).last
240
- message.split(INLINE_MESSAGE_END_DELIMITER).first.strip if message.match(INLINE_MESSAGE_END_DELIMITER)
240
+ message = message.split(INLINE_MESSAGE_END_DELIMITER).first.strip if message.match(INLINE_MESSAGE_END_DELIMITER)
241
+ message
241
242
  end
242
243
 
243
244
  def extract_and_assign_fields_from_original_mail(mail)
@@ -141,6 +141,14 @@ class BounceEmailTest < Test::Unit::TestCase
141
141
  assert_not_nil bounce.original_mail.subject
142
142
  end
143
143
 
144
+ def test_original_message_with_bounced_gmail
145
+ bounce = test_bounce('undeliverable_gmail')
146
+ assert_not_nil bounce.original_mail
147
+ assert_not_nil bounce.original_mail.message_id
148
+ assert_not_nil bounce.original_mail.to
149
+ assert_not_nil bounce.original_mail.from
150
+ assert_not_nil bounce.original_mail.subject
151
+ end
144
152
  private
145
153
 
146
154
  def load_email(name, prefix = 'fixtures')
@@ -0,0 +1,79 @@
1
+
2
+ Delivered-To: saghaulor@gmail.com
3
+ Received: by 10.96.89.195 with SMTP id bq3csp193052qdb;
4
+ Wed, 25 Mar 2015 16:06:37 -0700 (PDT)
5
+ X-Received: by 10.236.231.244 with SMTP id l110mr3446122yhq.76.1427324797301;
6
+ Wed, 25 Mar 2015 16:06:37 -0700 (PDT)
7
+ Return-Path: <>
8
+ Received: from mail-yk0-x246.google.com (mail-yk0-x246.google.com. [2607:f8b0:4002:c07::246])
9
+ by mx.google.com with ESMTPS id v10si1943530yhn.71.2015.03.25.16.06.37
10
+ for <saghaulor@gmail.com>
11
+ (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
12
+ Wed, 25 Mar 2015 16:06:37 -0700 (PDT)
13
+ Received-SPF: none (google.com: mail-yk0-x246.google.com does not designate permitted sender hosts) client-ip=2607:f8b0:4002:c07::246;
14
+ Authentication-Results: mx.google.com;
15
+ spf=none (google.com: mail-yk0-x246.google.com does not designate permitted sender hosts) smtp.mail=;
16
+ dkim=pass header.i=@googlemail.com
17
+ Received: by mail-yk0-x246.google.com with SMTP id u21so9169ykd.2
18
+ for <saghaulor@gmail.com>; Wed, 25 Mar 2015 16:06:37 -0700 (PDT)
19
+ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
20
+ d=googlemail.com; s=20120113;
21
+ h=mime-version:from:to:subject:message-id:date:content-type;
22
+ bh=zDroqkBtnjOx4oQsUjOsgCFXb0x6mWh6blclcKQ5iYI=;
23
+ b=PXS6yid56wdSx7roUQJoBggDMdNZT8cIIv5WQYV5IN4O/Vna8giENzEBwTsMyEPHBo
24
+ JfVgmhO6VWJ4RFjprNQdwHtBgU6XCmGKyK7pfQmmjyukMv+goACB/ApUnmDKgzV/QzuB
25
+ 3yAwRnPN4srOivQXM9l5TA5OUzoIS9rDGA+bg229WXSqU+xbsUE1hj1iCsL+1gsEqWMi
26
+ m0Vpo9putaSS2Xz0SmJFq8biRKXbinBSb5d33kDp8T9P5GkRPD15byuXEKIrwR/81wXn
27
+ miucJ+GuMV5Y/g7N49Nz51H6nQgG0P3VBMuQxLrNBQPb7ofnh09hsW6PwlEu0Ba2LHkS
28
+ 0A3w==
29
+ X-Received: by 10.140.144.11 with SMTP id 11mr14639966qhq.54.1427324797247;
30
+ Wed, 25 Mar 2015 16:06:37 -0700 (PDT)
31
+ MIME-Version: 1.0
32
+ Return-Path: <>
33
+ Received: by 10.140.144.11 with SMTP id 11mr12478298qhq.54; Wed, 25 Mar 2015
34
+ 16:06:37 -0700 (PDT)
35
+ From: Mail Delivery Subsystem <mailer-daemon@googlemail.com>
36
+ To: saghaulor@gmail.com
37
+ X-Failed-Recipients: undeliverable@coupa.com
38
+ Subject: Delivery Status Notification (Failure)
39
+ Message-ID: <001a1137654084e059051224f354@google.com>
40
+ Date: Wed, 25 Mar 2015 23:06:37 +0000
41
+ Content-Type: text/plain; charset=UTF-8
42
+
43
+ Delivery to the following recipient failed permanently:
44
+
45
+ undeliverable@coupa.com
46
+
47
+ Technical details of permanent failure:
48
+ Google tried to deliver your message, but it was rejected by the server for the recipient domain coupa.com by aspmx.l.google.com. [2607:f8b0:400d:c03::1b].
49
+
50
+ The error that the other server returned was:
51
+ 550-5.1.1 The email account that you tried to reach does not exist. Please try
52
+ 550-5.1.1 double-checking the recipient's email address for typos or
53
+ 550-5.1.1 unnecessary spaces. Learn more at
54
+ 550 5.1.1 http://support.google.com/mail/bin/answer.py?answer=6596 140si3605502qhd.80 - gsmtp
55
+
56
+
57
+ ----- Original message -----
58
+
59
+ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
60
+ d=gmail.com; s=20120113;
61
+ h=mime-version:from:date:message-id:subject:to:content-type;
62
+ bh=EeOLB+iPfnulBvl+QlMunNfssBotsqV19IRSrGZ7wjE=;
63
+ b=cZHw/hf4sqwgBCotRSuBGMcyEViNc9PIYhV/1wVrmYZYcXsleL0b2laAQD3ri5WO67
64
+ cLQc2a2tfTRfDFTiq1JQ9MOmcRatUUBmbkydjOq8R8Xqf4bi6wJobZL0ieiT/CHJtQuk
65
+ MLF/UkM10Ev/FBHFZSBnowZDhEjUzVRO4aRDHyPjzPS3+456c3ywuvb0nVDphKKMTrNW
66
+ FDyaYlG01XgkgPaguknjOVpK59cSJ/aQyLBW9EoQBEgOPtkzhXbVBbiM+7ofL6DXi7lm
67
+ UnMFYUkzKPnDoVlqD0d+ykjrun3a2gLD6aNXKQDynTmRpWvdzCRwsoC5UkflU5D4303U
68
+ +9HQ==
69
+ X-Received: by 10.140.144.11 with SMTP id 11mr14639959qhq.54.1427324797130;
70
+ Wed, 25 Mar 2015 16:06:37 -0700 (PDT)
71
+ MIME-Version: 1.0
72
+ From: Stephen Aghaulor <saghaulor@gmail.com>
73
+ Date: Wed, 25 Mar 2015 23:06:36 +0000
74
+ Message-ID: <CAEivLMBmmXp-4h7XtUzYy6V2KY44SJ_4yy=9u1+D9KaJ1jjcEg@mail.gmail.com>
75
+ Subject: Test
76
+ To: undeliverable@coupa.com
77
+ Content-Type: multipart/alternative; boundary=001a1137654083206f051224f3e9
78
+
79
+ Test
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bounce_email
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Bielohlawek
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-04-03 00:00:00.000000000 Z
14
+ date: 2015-04-07 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: mail
@@ -100,6 +100,7 @@ files:
100
100
  - test/bounces/tt_bounce_23.txt
101
101
  - test/bounces/tt_bounce_24.txt
102
102
  - test/bounces/tt_bounce_25.txt
103
+ - test/bounces/undeliverable_gmail.txt
103
104
  - test/bounces/unknown_code_bounce_01.txt
104
105
  - test/fixtures/no_subject.txt
105
106
  - test/non_bounces/tt_1234210666.txt
@@ -167,6 +168,7 @@ test_files:
167
168
  - test/bounces/tt_bounce_23.txt
168
169
  - test/bounces/tt_bounce_24.txt
169
170
  - test/bounces/tt_bounce_25.txt
171
+ - test/bounces/undeliverable_gmail.txt
170
172
  - test/bounces/unknown_code_bounce_01.txt
171
173
  - test/fixtures/no_subject.txt
172
174
  - test/non_bounces/tt_1234210666.txt