You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Minor, but it'd be useful to see an example in the readme of unsubscribing a single user with the gem. I couldn't find that listed anywhere but dug into the mailchimp API and took a flier and it worked. Let the people know it can be done! :)
(this is from within the User.rb model in a before_destroy callback, hence the "self")
def unsubscribe
mailchimp = Gibbon::API.new
result = mailchimp.lists.unsubscribe({
:id => ENV["MAILCHIMP_LIST_ID"],
:email => {:email => self.email},
:delete_member => true, # this is NOT the default value
:send_notify => true,
:send_goodbye => true
})
Rails.logger.info("Unsubscribed #{self.email} from MailChimp") if result
end
The text was updated successfully, but these errors were encountered:
Minor, but it'd be useful to see an example in the readme of unsubscribing a single user with the gem. I couldn't find that listed anywhere but dug into the mailchimp API and took a flier and it worked. Let the people know it can be done! :)
(this is from within the User.rb model in a before_destroy callback, hence the "self")
def unsubscribe
mailchimp = Gibbon::API.new
result = mailchimp.lists.unsubscribe({
:id => ENV["MAILCHIMP_LIST_ID"],
:email => {:email => self.email},
:delete_member => true, # this is NOT the default value
:send_notify => true,
:send_goodbye => true
})
Rails.logger.info("Unsubscribed #{self.email} from MailChimp") if result
end
The text was updated successfully, but these errors were encountered: