Sha256: b1d4392eee6d19c82a92ff203ab5742426814c8a418b66be9ebdb0593fd9ac96
Contents?: true
Size: 757 Bytes
Versions: 3
Compression:
Stored size: 757 Bytes
Contents
require 'letter_opener' module Goatmail class DeliveryMethod < LetterOpener::DeliveryMethod def initialize(options = {}) raise InvalidOption, "A location option is required when using the Goatmail delivery method" if Goatmail.location.nil? self.settings = options end def deliver!(mail) location = File.join(Goatmail.location, "#{Time.now.to_i}_#{Digest::SHA1.hexdigest(mail.encoded)[0..6]}") messages = LetterOpener::Message.rendered_messages(location, mail) meta_data = { subject: mail.subject.to_s, to: mail.to.join(", "), from: mail.from.join(', ') } File.open(File.join(location, 'meta'), 'wb') {|f| Marshal.dump(meta_data, f)} messages end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
goatmail-1.1.1 | lib/goatmail/delivery_method.rb |
goatmail-1.1.0 | lib/goatmail/delivery_method.rb |
goatmail-1.0.0 | lib/goatmail/delivery_method.rb |