aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mail_handler
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mail_handler')
-rw-r--r--lib/mail_handler/backends/mail_backend.rb5
-rw-r--r--lib/mail_handler/backends/mail_extensions.rb9
-rw-r--r--lib/mail_handler/mail_handler.rb3
3 files changed, 10 insertions, 7 deletions
diff --git a/lib/mail_handler/backends/mail_backend.rb b/lib/mail_handler/backends/mail_backend.rb
index 9b647e2fa..9e3fbc008 100644
--- a/lib/mail_handler/backends/mail_backend.rb
+++ b/lib/mail_handler/backends/mail_backend.rb
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
require 'mail'
require 'mapi/msg'
require 'mapi/convert'
@@ -35,7 +36,7 @@ module MailHandler
module Backends
module MailBackend
- def backend()
+ def backend
'Mail'
end
@@ -128,7 +129,7 @@ module MailHandler
envelope_to = mail['envelope-to'] ? [mail['envelope-to'].value.to_s] : []
((mail.to || []) +
(mail.cc || []) +
- (envelope_to || [])).uniq
+ (envelope_to || [])).compact.uniq
end
def empty_return_path?(mail)
diff --git a/lib/mail_handler/backends/mail_extensions.rb b/lib/mail_handler/backends/mail_extensions.rb
index f778cbc14..b39e54d08 100644
--- a/lib/mail_handler/backends/mail_extensions.rb
+++ b/lib/mail_handler/backends/mail_extensions.rb
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
require 'mail/message'
require 'mail/part'
require 'mail/fields/common/parameter_hash'
@@ -37,7 +38,7 @@ module Mail
# Can be removed when we no longer support Ruby 1.8
class Ruby18
- def Ruby18.b_value_decode(str)
+ def self.b_value_decode(str)
match = str.match(/\=\?(.+)?\?[Bb]\?(.+)?\?\=/m)
if match
encoding = match[1]
@@ -55,7 +56,7 @@ module Mail
str
end
- def Ruby18.q_value_decode(str)
+ def self.q_value_decode(str)
match = str.match(/\=\?(.+)?\?[Qq]\?(.+)?\?\=/m)
if match
encoding = match[1]
@@ -75,7 +76,7 @@ module Mail
private
- def Ruby18.fix_encoding(encoding)
+ def self.fix_encoding(encoding)
case encoding.upcase
when 'UTF8'
'UTF-8'
@@ -86,7 +87,7 @@ module Mail
end
class Ruby19
- def Ruby19.b_value_decode(str)
+ def self.b_value_decode(str)
match = str.match(/\=\?(.+)?\?[Bb]\?(.+)?\?\=/m)
if match
charset = match[1]
diff --git a/lib/mail_handler/mail_handler.rb b/lib/mail_handler/mail_handler.rb
index 33d939e22..313869d16 100644
--- a/lib/mail_handler/mail_handler.rb
+++ b/lib/mail_handler/mail_handler.rb
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
# Handles the parsing of email
require 'tmpdir'
@@ -133,7 +134,7 @@ module MailHandler
begin
zip_file = Zip::ZipFile.open(tempfile.path)
text += get_attachment_text_from_zip_file(zip_file)
- zip_file.close()
+ zip_file.close
rescue
$stderr.puts("Error processing zip file: #{$!.inspect}")
end