Upload files to 'lib/postman/rails'

This commit is contained in:
nikkel 2020-03-20 03:32:30 +07:00
parent 0a8066ca76
commit c0e26f5ba6
2 changed files with 36 additions and 0 deletions

View 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

View File

@ -0,0 +1,5 @@
module Postman
module Rails
VERSION = '1.0.1'
end
end