From 1589bd9ac364ec7c8d27b130705a4fa1ab9feb43 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Thu, 3 Dec 2015 14:54:10 +1100 Subject: [PATCH] Use `mail()` instead of `devise_mail` The EnterpriseMailer used `devise_mail` to send confirmation instructions. That call is more complicated than `mail` and added an unwanted reply-to header. --- app/mailers/enterprise_mailer.rb | 9 +++------ .../confirmation_instructions.html.haml | 6 +++--- spec/mailers/enterprise_mailer_spec.rb | 3 ++- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/app/mailers/enterprise_mailer.rb b/app/mailers/enterprise_mailer.rb index 8ef7e74044..248e31f109 100644 --- a/app/mailers/enterprise_mailer.rb +++ b/app/mailers/enterprise_mailer.rb @@ -11,12 +11,9 @@ class EnterpriseMailer < Spree::BaseMailer def confirmation_instructions(record, token, opts={}) @token = token find_enterprise(record) - opts = { - subject: "Please confirm your email for #{@enterprise.name}", - to: ( @enterprise.unconfirmed_email || @enterprise.email ), - from: from_address, - } - devise_mail(record, :confirmation_instructions, opts) + mail(subject: "Please confirm your email for #{@enterprise.name}", + to: ( @enterprise.unconfirmed_email || @enterprise.email ), + from: from_address) end private diff --git a/app/views/enterprise_mailer/confirmation_instructions.html.haml b/app/views/enterprise_mailer/confirmation_instructions.html.haml index 54734b8480..c1b288f6ef 100644 --- a/app/views/enterprise_mailer/confirmation_instructions.html.haml +++ b/app/views/enterprise_mailer/confirmation_instructions.html.haml @@ -1,14 +1,14 @@ %h3 - = t :email_confirmation_greeting, contact: @resource.contact + = t :email_confirmation_greeting, contact: @enterprise.contact %p.lead - = t :email_confirmation_profile_created, name: @resource.name + = t :email_confirmation_profile_created, name: @enterprise.name %p   %p.callout = t :email_confirmation_click_link %br %strong - = link_to t(:email_confirmation_link_label), confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) + = link_to t(:email_confirmation_link_label), confirmation_url(@enterprise, :confirmation_token => @enterprise.confirmation_token) %p   %p diff --git a/spec/mailers/enterprise_mailer_spec.rb b/spec/mailers/enterprise_mailer_spec.rb index 65480ccdad..eaa21b54ae 100644 --- a/spec/mailers/enterprise_mailer_spec.rb +++ b/spec/mailers/enterprise_mailer_spec.rb @@ -14,6 +14,7 @@ describe EnterpriseMailer do mail = ActionMailer::Base.deliveries.first expect(mail.subject).to eq "Please confirm your email for #{enterprise.name}" expect(mail.to).to include enterprise.email + expect(mail.reply_to).to be_nil end end @@ -38,4 +39,4 @@ describe EnterpriseMailer do mail = ActionMailer::Base.deliveries.first expect(mail.subject).to eq "#{enterprise.name} is now on #{Spree::Config[:site_name]}" end -end \ No newline at end of file +end