Sha256: 96f1122fbf9daa81e8b5574a537dd09400d1b17ee4bd9319ebfac9778c4217f0
Contents?: true
Size: 1002 Bytes
Versions: 10
Compression:
Stored size: 1002 Bytes
Contents
# -*- coding: utf-8 -*- module Cloudfuji class MailController < ApplicationController # POST /cloudfuji/mail def index puts "Handling email!" mail = {} attachments = [] # Strip the attachments first params.keys.each do |key| attachments << params.delete(key) if key =~ /attachment-\d+/ end # Copy the params to the hook data (params.keys - ["controller", "action"]).each do |param| mail[param.downcase] = params[param] end mail["attachments"] = attachments puts "params: #{params.inspect}" puts "mail: #{mail.inspect}" # Output for debugging remotely Cloudfuji::Mailroute.pretty_print_routes puts "Finished routing" # Mailroute is in charge of figuring out which callback to trigger Cloudfuji::Mailroute.routes.process(mail) result = {:success => true, :message => nil, :data => {}} render :text => result.to_json, :status => 200 end end end
Version data entries
10 entries across 10 versions & 1 rubygems