Skip to content

Instantly share code, notes, and snippets.

@nikz
Created April 29, 2010 06:28
Show Gist options
  • Select an option

  • Save nikz/383227 to your computer and use it in GitHub Desktop.

Select an option

Save nikz/383227 to your computer and use it in GitHub Desktop.
module ActionMailer
class Base
def deliver_with_noob_protection!(mail = @mail)
[:to, :cc, :bcc].each do |recipient_group|
old_emails = mail.send(recipient_group)
unless old_emails.nil?
# clear out the old
mail.send("#{recipient_group}=", [])
# add in new, protected emails
mail.send("#{recipient_group}=", old_emails.map { |em| "team+#{em.gsub("@", "-")}@minutedock.com" })
end
end
deliver_without_noob_protection!(mail)
end
alias_method_chain :deliver!, :noob_protection
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment