Skip to content

Instantly share code, notes, and snippets.

@starrhorne
Last active December 13, 2015 23:38
Show Gist options
  • Save starrhorne/4992593 to your computer and use it in GitHub Desktop.
Save starrhorne/4992593 to your computer and use it in GitHub Desktop.
Example of how to use the Incoming! gem.
# First, you define an email receiver class
class EmailReceiver < Incoming::Strategies::CloudMailin
def receive(mail)
puts %(Got message from #{mail.to.first} with subject "#{mail.subject}")
end
end
# Then you feed it a Rack::Request object. And you're done.
req = Rack::Request.new(env)
result = EmailReceiver.receive(req) # => Got message from whoever@wherever.com with subject "hello world"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment