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.
- bundle project new gem version
- start rails console
- send random email
- be disappointed header not appear in email. bcc address displayed.
- run
reload!
- send email again
- 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.
- intercept call deliver_message
mail.header[:'foo'] = 'bar'
Comments
Post a Comment