ruby on rails - Custom email header is only present after a console reload -


i have been trying set global email header across of our projects of gem of ours. gem used add bcc email of our emails among other things. added code header method adds bcc email address.

the bcc address added correctly throughout of our projects know line of code run on startup.

this code of gem in question.

  actionmailer::base.default "foo" => 'bar'   bcc = message.bcc.to_a   bcc << bcc_address   message.bcc bcc 

the idea header present throughout of our emails.

now comes interesting part , steps have taken create issue having.

  1. bundle project new gem version
  2. start rails console
  3. send random email
  4. be disappointed header not appear in email. bcc address displayed.
  5. run reload!
  6. send email again
  7. be confused why header present

i tried in rails 3.2.22.5 (ruby 2.2.4) , rails 4.2.9. (ruby 2.4.1) header not included when running specs bcc address present there.

does have idea might causing these weird symptoms?

alright issue has defaults being cashed email. defaults not rechecked when resend email.

to work around changed way gem handles act in between each mail want send doing following.

  1. intercept call deliver_message
  2. mail.header[:'foo'] = 'bar'

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -