class HttpActionMailer::DeliveryMethod
Public Class Methods
new(settings)
click to toggle source
# File lib/http_action_mailer/delivery_method.rb, line 6 def initialize(settings) @settings = settings end
Public Instance Methods
deliver!(mail)
click to toggle source
# File lib/http_action_mailer/delivery_method.rb, line 10 def deliver!(mail) http_post(mail) end
Private Instance Methods
http_post(mail)
click to toggle source
# File lib/http_action_mailer/delivery_method.rb, line 16 def http_post(mail) conn = Faraday.new(url: @settings[:url]) conn.post do |r| r.path = "#{@settings[:path]}/#{Array(mail.to).first}" r.headers = @settings[:headers] if @settings[:headers] r.body = { from: mail.from, to: mail.to, cc: mail.cc, subject: mail.subject, text: mail.text_part.body.raw_source, html: mail.html_part.body.raw_source, }.to_json end end