emailparser 0.0.4 → 0.0.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 +4 -4
- data/lib/emailparser.rb +6 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2a17693e8619176df07b07e970876455c46d842
|
4
|
+
data.tar.gz: 2b376d72f9e156a209fa672cb34d89da4961a1bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc882ef9e036077f3882cc2a4f20fa0ec7c0ceb9a6b92b36c303557a46c47bb9060e5731f6d5fa11ee599bd318a6afa5a096c6b843fcefe47fb2fcf7a3421ff1
|
7
|
+
data.tar.gz: 3c4aa896ce2c7ca32db45635456dbca81df151705ed290248e4c3ccdac7115597b82444f5600c470b9649b8b776af266138e44cedd46d7d3b8f5bb00261935fb
|
data/lib/emailparser.rb
CHANGED
@@ -21,7 +21,7 @@ class Emailparser
|
|
21
21
|
# Accepts a message
|
22
22
|
def parse_message
|
23
23
|
|
24
|
-
puts "loading email: " + @message
|
24
|
+
puts "loading email: " + @message + "\n"
|
25
25
|
|
26
26
|
email = Mail.read(@message)
|
27
27
|
|
@@ -46,15 +46,15 @@ class Emailparser
|
|
46
46
|
|
47
47
|
# Check for Multipart
|
48
48
|
if email.multipart?
|
49
|
-
puts "is a multipart email"
|
50
|
-
if email.text_part.body
|
49
|
+
puts "- is a multipart email\n"
|
50
|
+
if email.text_part.body?
|
51
51
|
body_plain = fix_encode(email.text_part.body.decoded)
|
52
52
|
end
|
53
|
-
if email.html_part.body
|
53
|
+
if email.html_part.body?
|
54
54
|
body_html = fix_encode(email.html_part.body.decoded)
|
55
55
|
end
|
56
56
|
else
|
57
|
-
puts "is single part email"
|
57
|
+
puts "- is single part email\n"
|
58
58
|
body_plain = fix_encode(email.body.decoded)
|
59
59
|
body_html = fix_encode(email.body.decoded)
|
60
60
|
end
|
@@ -64,7 +64,7 @@ class Emailparser
|
|
64
64
|
if (attachment.content_type.start_with?('image/'))
|
65
65
|
filename = fix_encode(attachment.filename)
|
66
66
|
attachments.push(filename)
|
67
|
-
print "found attachment " + filename + "\n"
|
67
|
+
print "- found attachment " + filename + "\n"
|
68
68
|
begin
|
69
69
|
File.open(@attachment_dir + filename, "w+b", 0644) do |f|
|
70
70
|
f.write attachment.body.decoded
|