Skip to content

Instantly share code, notes, and snippets.

@RSpace
Created November 5, 2009 20:53
Show Gist options
  • Save RSpace/227365 to your computer and use it in GitHub Desktop.
Save RSpace/227365 to your computer and use it in GitHub Desktop.
module BccAllMails
BCC_ALL_EMAILS_TO = "[email protected]"
def self.included(base)
base.class_eval {
include InstanceMethods
alias_method_chain :deliver!, :bcc_all_mails
}
end
module InstanceMethods
def deliver_with_bcc_all_mails!(mail = @mail)
if mail.bcc.instance_of?(Array)
mail.bcc += [BCC_ALL_EMAILS_TO]
else
mail.bcc = BCC_ALL_EMAILS_TO
end
deliver_without_bcc_all_mails!(mail)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment