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.
This commit is contained in:
Maikel Linke
2015-12-03 14:54:10 +11:00
parent a810a6e2b7
commit 1589bd9ac3
3 changed files with 8 additions and 10 deletions

View File

@@ -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

View File

@@ -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 &nbsp;
%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 &nbsp;
%p

View File

@@ -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
end