Created
November 5, 2009 20:53
-
-
Save RSpace/227365 to your computer and use it in GitHub Desktop.
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
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