received 0.3.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,8 +11,8 @@ module Received
11
11
  # @option params [String] database
12
12
  # @option params [String] collection
13
13
  def initialize(params)
14
- @db = Mongo::Connection.new(params['host']).db(params['database'])
15
- @coll = @db.collection(params['collection'])
14
+ db = Mongo::Connection.new(params['host']).db(params['database'])
15
+ @coll = db.collection(params['collection'])
16
16
  end
17
17
 
18
18
  # Store mail in MongoDB
@@ -20,7 +20,8 @@ module Received
20
20
  # @param [Hash] mail
21
21
  # @return [ObjectId] object_id
22
22
  def store(mail)
23
- @coll.insert(mail.merge({:ts => Time.now.to_i}), :safe => {:fsync => true})
23
+ mail = mail.merge(:ts => Time.now.to_i, :body => BSON::Binary.new(mail[:body]))
24
+ @coll.insert(mail, :safe => {:fsync => true})
24
25
  end
25
26
  end
26
27
  end
@@ -46,6 +46,7 @@ module Received
46
46
  false
47
47
  rescue Exception => e
48
48
  logger.error "saving of mail from #{mail[:from]} failed with: #{e.message}"
49
+ logger.error e.backtrace.join("\n")
49
50
  false
50
51
  end
51
52
  end
@@ -1,3 +1,3 @@
1
1
  module Received
2
- VERSION = "0.3.3"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: received
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: