diff --git a/app/models/spree/app_configuration.rb b/app/models/spree/app_configuration.rb index 63aca0c852..89f3bd7f13 100644 --- a/app/models/spree/app_configuration.rb +++ b/app/models/spree/app_configuration.rb @@ -88,7 +88,6 @@ module Spree # Default mail headers settings preference :mails_from, :string, default: 'ofn@example.com' preference :mail_bcc, :string, default: 'ofn@example.com' - preference :intercept_email, :string, default: nil # Default smtp settings preference :mail_host, :string, default: 'localhost' diff --git a/app/services/mail_configuration.rb b/app/services/mail_configuration.rb index 5a06fda324..e2863a7b26 100644 --- a/app/services/mail_configuration.rb +++ b/app/services/mail_configuration.rb @@ -22,7 +22,6 @@ class MailConfiguration secure_connection_type: ENV.fetch('MAIL_SECURE_CONNECTION', 'None'), mails_from: ENV.fetch('MAILS_FROM', "no-reply@#{ENV.fetch('MAIL_DOMAIN')}"), mail_bcc: ENV.fetch('MAIL_BCC', ''), - intercept_email: '' } end diff --git a/app/views/spree/admin/mail_methods/_form.html.haml b/app/views/spree/admin/mail_methods/_form.html.haml index 327c0874a0..b3faab8e9c 100644 --- a/app/views/spree/admin/mail_methods/_form.html.haml +++ b/app/views/spree/admin/mail_methods/_form.html.haml @@ -18,10 +18,3 @@ %br/ %span.info = t("spree.smtp_send_copy_to_this_addresses") - .field - = label_tag :intercept_email, t("spree.intercept_email_address") - %br/ - = text_field_tag :intercept_email, Spree::Config[:intercept_email], disabled: true, class: 'fullwidth' - %br/ - %span.info - = t("spree.intercept_email_instructions") diff --git a/config/locales/en.yml b/config/locales/en.yml index 3d0071804c..1d28141799 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3759,8 +3759,6 @@ See the %{link} to find out more about %{sitename}'s features and to start using smtp_send_all_emails_as_from_following_address: "Send all mails as from the following address." send_copy_of_all_mails_to: "Send Copy of All Mails To" smtp_send_copy_to_this_addresses: "Sends a copy of all outgoing mails to this address. For multiple addresses, separate with commas." - intercept_email_address: "Intercept Email Address" - intercept_email_instructions: "Override email recipient and replace with this address." tax_categories: "Tax Categories" listing_tax_categories: "Listing Tax Categories" diff --git a/lib/spree/core/mail_interceptor.rb b/lib/spree/core/mail_interceptor.rb index 27f7126218..76b60bce02 100644 --- a/lib/spree/core/mail_interceptor.rb +++ b/lib/spree/core/mail_interceptor.rb @@ -8,11 +8,6 @@ module Spree module Core class MailInterceptor def self.delivering_email(message) - if Config[:intercept_email].present? - message.subject = "#{message.to} #{message.subject}" - message.to = Config[:intercept_email] - end - return if Config[:mail_bcc].blank? message.bcc ||= Config[:mail_bcc] diff --git a/spec/lib/spree/core/mail_interceptor_spec.rb b/spec/lib/spree/core/mail_interceptor_spec.rb index fff2b44c59..cf4569a530 100644 --- a/spec/lib/spree/core/mail_interceptor_spec.rb +++ b/spec/lib/spree/core/mail_interceptor_spec.rb @@ -34,38 +34,5 @@ describe Spree::OrderMailer do @email = ActionMailer::Base.deliveries.first expect(@email.bcc).to eq ["bcc-foo@foobar.com"] end - - context "when intercept_email is provided" do - it "should strip the bcc recipients" do - expect(message.bcc).to be_blank - end - - it "should strip the cc recipients" do - expect(message.cc).to be_blank - end - - it "should replace the receipient with the specified address" do - Spree::Config[:intercept_email] = "intercept@foobar.com" - message.deliver_now - @email = ActionMailer::Base.deliveries.first - expect(@email.to).to eq ["intercept@foobar.com"] - end - - it "should modify the subject to include the original email" do - Spree::Config[:intercept_email] = "intercept@foobar.com" - message.deliver_now - @email = ActionMailer::Base.deliveries.first - expect(@email.subject).to include order.distributor.contact.email - end - end - - context "when intercept_mode is not provided" do - it "should not modify the recipient" do - Spree::Config[:intercept_email] = "" - message.deliver_now - @email = ActionMailer::Base.deliveries.first - expect(@email.to).to eq [order.distributor.contact.email] - end - end end end diff --git a/spec/services/mail_configuration_spec.rb b/spec/services/mail_configuration_spec.rb index 74873b90c4..f0f10a9c4b 100644 --- a/spec/services/mail_configuration_spec.rb +++ b/spec/services/mail_configuration_spec.rb @@ -21,7 +21,6 @@ describe MailConfiguration do expect(Spree::Config).to have_received(:[]=).with(:secure_connection_type, "None") expect(Spree::Config).to have_received(:[]=).with(:mails_from, "no-reply@example.com") expect(Spree::Config).to have_received(:[]=).with(:mail_bcc, "") - expect(Spree::Config).to have_received(:[]=).with(:intercept_email, "") end it 'initializes the mail settings' do diff --git a/spec/system/admin/configuration/mail_methods_spec.rb b/spec/system/admin/configuration/mail_methods_spec.rb index ab2aeb2fe0..0bf637ea58 100644 --- a/spec/system/admin/configuration/mail_methods_spec.rb +++ b/spec/system/admin/configuration/mail_methods_spec.rb @@ -16,7 +16,6 @@ describe "Mail Methods" do it "only allows changing the mails_from setting" do fill_in 'mails_from', with: 'ofn@example.com' fill_in 'mail_bcc', with: 'bcc@example.com' - expect(page).to have_field('intercept_email', disabled: true) click_button 'Update' expect(page).to have_content('successfully updated!')