class HttpMailer::MandrillServiceHandler
Attributes
sevice_api[RW]
Public Class Methods
new(settings)
click to toggle source
Calls superclass method
# File lib/http_mailer/mandrill/mandrill_service_handler.rb, line 5 def initialize(settings) super(settings) @service_api = ::HttpMailer::MandrillServiceApi.new(self.service_configuration.settings.host) end
Public Instance Methods
send_message(from, to, subject, text, from_name='', to_name='')
click to toggle source
# File lib/http_mailer/mandrill/mandrill_service_handler.rb, line 10 def send_message(from, to, subject, text, from_name='', to_name='') message = MandrillMessage.new(from, to, subject, text, nil, from_name, to_name) payload = { :key => self.service_configuration.settings.api_key, :message => message.to_h }.to_json ::RestClient.post(self.service_api.send_messages_url, payload, :content_type => :json, :accept => :json ) rescue => e puts e.inspect e.response end