Skip to content

Commit

Permalink
Fix for deliver error
Browse files Browse the repository at this point in the history
  • Loading branch information
bdmac committed Jan 30, 2012
1 parent 3371930 commit 320ad98
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/letter_opener/delivery_method.rb
@@ -1,11 +1,13 @@
module LetterOpener
class DeliveryMethod
def initialize(options = {})
@options = {:location => './letter_opener'}.merge!(options)
self.settings = {:location => './letter_opener'}.merge!(options)
end

attr_accessor :settings

def deliver!(mail)
location = File.join(@options[:location], "#{Time.now.to_i}_#{Digest::SHA1.hexdigest(mail.encoded)[0..6]}")
location = File.join(settings[:location], "#{Time.now.to_i}_#{Digest::SHA1.hexdigest(mail.encoded)[0..6]}")
messages = mail.parts.map { |part| Message.new(location, mail, part) }
messages << Message.new(location, mail) if messages.empty?
messages.each { |message| message.render }
Expand Down

0 comments on commit 320ad98

Please sign in to comment.