-
Notifications
You must be signed in to change notification settings - Fork 15
Description
The Issue
After upgrading to v2.1.0, we noticed that all of our mailer specs started failing. After investigating I have tracked the issue to the removal of the headers
hash from the call to ActionMailer::Base#mail
within the Mail::Notify::Mailer#view_mail
method.
mail-notify/lib/mail/notify/mailer.rb
Line 85 in f4c92ac
body = mail.body.raw_source |
I found a comment from @mec fairly questioning the usefulness of passing headers through to the ActionMailer::Base#mail
method, however I think some of the headers are still useful, despite not being passed through to Notify.
Our application does not make use of mailer templates for all of our mailers, and we instead rely on yaml files to define our content. In the ActionMailer::Base#mail
method, one of the accepted headers is body
, when a body
header is specified the method will utilise the value passed through instead of looking for a template - in our case a template does not exist and therefore causes an error when upgrading to the latest version of this gem.
Also of note are the template_path
and template_name
headers which may also result in a similar error if other applications utilise these headers for non-standard template paths.
Potential solutions
I agree with the general line of thought that limiting headers makes sense, so I'm not proposing that we pull through the entire headers
hash again, however I do think the inclusion of body
, template_path
and template_name
headers would be sensible given the intent of this method is to set the body in the personalisation so that it can be sent through to the Notify API and these headers specifically aid in finding the content for the message body.