Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module BccAllMails
- BCC_ALL_EMAILS_TO = "admin@example.com"
- 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
Add Comment
Please, Sign In to add comment