Created
April 6, 2012 10:01
-
-
Save noverloop/2318592 to your computer and use it in GitHub Desktop.
Sendmail Callback, deactivate users who bounce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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