Upload files to 'lib/postman/rails'
This commit is contained in:
parent
0a8066ca76
commit
c0e26f5ba6
31
lib/postman/rails/action_mailer_delivery_method.rb
Normal file
31
lib/postman/rails/action_mailer_delivery_method.rb
Normal file
@ -0,0 +1,31 @@
|
||||
module Postman
|
||||
module Rails
|
||||
class ActionMailerDeliveryMethod
|
||||
|
||||
def initialize(settings)
|
||||
@settings = settings
|
||||
end
|
||||
|
||||
def settings
|
||||
@settings
|
||||
end
|
||||
|
||||
def deliver!(message)
|
||||
client.send_raw_message do |m|
|
||||
m.mail_from(message.from.first)
|
||||
[message.to, message.cc, message.bcc].flatten.compact.uniq.each do |address|
|
||||
m.rcpt_to(address)
|
||||
end
|
||||
m.data(message.to_s)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def client
|
||||
@client ||= Postman::Client.new(@settings[:host] || ENV['POSTMAN_HOST'], @settings[:server_key] || ENV['POSTMAN_KEY'])
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
5
lib/postman/rails/version.rb
Normal file
5
lib/postman/rails/version.rb
Normal file
@ -0,0 +1,5 @@
|
||||
module Postman
|
||||
module Rails
|
||||
VERSION = '1.0.1'
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user