diff --git a/README.md b/README.md index 8454cfa..32e4ee0 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ rake db:migrate - Create a mailer method for each email - Mailer objects need to inherit from `Effective::LiquidMailer` - Mailer methods and email template slugs need to match up - - Email headers will be automatically used from your model but may be overwritten in the mail method (from, subject, cc, and bcc) + - Email headers can be declared in the #mail method but can be overrided by the saved attributes on the Effective::EmailTemplate model. ```ruby # app/mailers/user_liquid_mailer.rb diff --git a/lib/effective/liquid_mailer.rb b/lib/effective/liquid_mailer.rb index ab84599..9af2ba8 100644 --- a/lib/effective/liquid_mailer.rb +++ b/lib/effective/liquid_mailer.rb @@ -4,7 +4,7 @@ def mail(headers = {}, &block) # this be dangerous and requires ruby 2.0+ mail_method = caller_locations(1,1)[0].label email_template = EffectiveEmailTemplates.get(mail_method) - headers = email_template.mail_options.merge(headers) + headers = headers.merge(email_template.mail_options) super(headers, &block) end end