Skip to content

Instantly share code, notes, and snippets.

@tadman
Created June 4, 2014 18:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tadman/d20db52f1ec2021cf9d3 to your computer and use it in GitHub Desktop.
Save tadman/d20db52f1ec2021cf9d3 to your computer and use it in GitHub Desktop.
PostageApp Delivery System for use with Devise
config.action_mailer.delivery_method = :postageapp
require_relative '../../lib/postageapp_delivery.rb'
PostageApp.configure do |config|
config.api_key = 'YOUR_API_KEY'
end
ActionMailer::Base.add_delivery_method :postageapp, PostageAppDelivery
class PostageAppDelivery
def initialize(opts)
# noop
end
def deliver!(mail)
request = PostageApp::Request.new(:send_message, {
'headers' => {
'from' => mail.from,
'subject' => mail.subject
},
'recipients' => mail.to,
'content' => {
'text/html' => mail.body.to_s
}
})
response = request.send
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment