Skip to content

Instantly share code, notes, and snippets.

@maxwell
Created July 28, 2011 19:19
Show Gist options
  • Save maxwell/1112309 to your computer and use it in GitHub Desktop.
Save maxwell/1112309 to your computer and use it in GitHub Desktop.
message bus email interceptor wip
##register this class as an interceptor
##this should be in the message_bus_ruby_api gem, and needs to have configuration, and #map to action mailer in a less dumb way
#also, can we prevent action mailer from continuing to do its default config?
#no time to dig into it now.
require 'message_bus_ruby_api'
class MessageBusInterceptor
def self.delivering_email(message)
client = MessagebusRubyApi::Client.new(MESSAGE_BUS_API_KEY)
required_params = {
:subject => message.subject
:body => message.body
:fromEmail => message.from
:toEmail => message.to
}
optional_params = {
:fromName => ''
:toName => ''
:tag => ""
}
params = required_params.merge(optional_params)
client.send_email(params)
message
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment