Skip to content

Instantly share code, notes, and snippets.

@starrhorne
Last active December 13, 2015 23:38

Revisions

  1. starrhorne revised this gist Feb 20, 2013. 1 changed file with 9 additions and 9 deletions.
    18 changes: 9 additions & 9 deletions sample_email_receiver.rb
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,10 @@
    # 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
    # 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 [email protected] with subject "hello world"
    # Then you feed it a Rack::Request object. And you're done.
    req = Rack::Request.new(env)
    result = EmailReceiver.receive(req) # => Got message from [email protected] with subject "hello world"
  2. starrhorne renamed this gist Feb 20, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. starrhorne created this gist Feb 20, 2013.
    10 changes: 10 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    # 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 [email protected] with subject "hello world"