vmail 1.9.3 → 1.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/vmail/imap_client.rb +5 -1
- data/lib/vmail/message_formatter.rb +4 -10
- data/lib/vmail/reply_templating.rb +1 -1
- data/lib/vmail/version.rb +1 -1
- metadata +1 -1
data/lib/vmail/imap_client.rb
CHANGED
@@ -285,6 +285,9 @@ module Vmail
|
|
285
285
|
def format_headers(hash)
|
286
286
|
lines = []
|
287
287
|
hash.each_pair do |key, value|
|
288
|
+
if value.nil?
|
289
|
+
next
|
290
|
+
end
|
288
291
|
if value.is_a?(Array)
|
289
292
|
value = value.join(", ")
|
290
293
|
end
|
@@ -347,9 +350,10 @@ EOF
|
|
347
350
|
mail = Mail.new
|
348
351
|
raw_headers, raw_body = *text.split(/\n\s*\n/, 2)
|
349
352
|
headers = {}
|
353
|
+
|
350
354
|
raw_headers.split("\n").each do |line|
|
351
355
|
key, value = *line.split(/:\s*/, 2)
|
352
|
-
if key == '
|
356
|
+
if key == 'references'
|
353
357
|
mail.references = value
|
354
358
|
else
|
355
359
|
next if (value.nil? || value.strip == '')
|
@@ -85,20 +85,14 @@ module Vmail
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def extract_headers(mail = @mail)
|
88
|
-
headers = {
|
88
|
+
headers = {
|
89
|
+
'from' => utf8(mail['from'].decoded),
|
89
90
|
'date' => (mail.date.strftime('%a, %b %d %I:%M %p %Z %Y') rescue mail.date),
|
90
91
|
'to' => mail['to'].nil? ? nil : utf8(mail['to'].decoded),
|
92
|
+
'cc' => (mail.cc && utf8(mail['cc'].decoded.to_s)),
|
93
|
+
'reply_to' => (mail.reply_to && utf8(mail['reply_to'].decoded)),
|
91
94
|
'subject' => utf8(mail.subject)
|
92
95
|
}
|
93
|
-
if !mail.cc.nil?
|
94
|
-
headers['cc'] = utf8(mail['cc'].decoded.to_s)
|
95
|
-
end
|
96
|
-
if !mail.reply_to.nil?
|
97
|
-
headers['reply_to'] = utf8(mail['reply_to'].decoded)
|
98
|
-
end
|
99
|
-
if mail['message-id']
|
100
|
-
headers['references'] = mail['message-id']
|
101
|
-
end
|
102
96
|
headers
|
103
97
|
rescue
|
104
98
|
{'error' => $!}
|
@@ -25,7 +25,7 @@ module Vmail
|
|
25
25
|
reply_body = reply_quote_header + divider('-') +
|
26
26
|
(current_message.plaintext.split(/^-+$/,2)[1])
|
27
27
|
{
|
28
|
-
'
|
28
|
+
'references' => current_message.message_id,
|
29
29
|
'from' => "#@name <#@username>",
|
30
30
|
'to' => reply_recipient,
|
31
31
|
'cc' => reply_cc,
|
data/lib/vmail/version.rb
CHANGED