DEV Community

Discussion on: Using Mail Interceptors in Rails

nuclearspike profile image

But doesn't the Interceptors version not do anything with the cc array? In the ApplicationMailer version, it iterates over the ccs and calls super(mail) for each. In the Interceptors module, it just creates a string of the cc's but then wipes out that array, then creates a string that says it is going to all of those users but there's no code that causes that to happen. Correct?

drbragg profile image
Drew Bragg Author

Yup, I called that out after the example

Aside from the slight changes to how we handle CC's (which the team is happy with) this will do the same thing as the original code

We actually ended up missing the additional CC emails so that block has since been replaced with:

if do |recipient|
      "from" => mail.from,
      "recipients" => recipient,
      "subject" => "CCed version of: #{original_subject}",
      "plain_text_content" =>,
      "html_content" =>
  end = []
Enter fullscreen mode Exit fullscreen mode

So now it does basically the same thing.