Skip to content

Instantly share code, notes, and snippets.

@noverloop
Created April 6, 2012 10:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noverloop/2318592 to your computer and use it in GitHub Desktop.
Save noverloop/2318592 to your computer and use it in GitHub Desktop.
Sendmail Callback, deactivate users who bounce
class MailController < ApplicationController
layout "none"
# the sendgrid notification callback.
def notification
puts params
u = User.where(:email => params["email"]).first
if params["event"] == 'bounce'
u.deactivate! "an invalid email address has been provided"
elsif params["event"] == 'spamreport'
u.deactivate! "a spam report was filed from your email address"
end
render :text => "OK"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment