diff --git a/backend/app/views/spree/admin/stores/_form.html.erb b/backend/app/views/spree/admin/stores/_form.html.erb index eaf18379936..0763fed2b0e 100644 --- a/backend/app/views/spree/admin/stores/_form.html.erb +++ b/backend/app/views/spree/admin/stores/_form.html.erb @@ -1,3 +1,4 @@ +<<<<<<< HEAD <%= f.field_container :name do %> <%= f.label :name, class: 'required' %> <%= f.text_field :name, required: true, class: 'fullwidth' %> @@ -40,6 +41,12 @@ <%= f.error_message_on :mail_from_address %> <% end %> +<%= f.field_container :bcc_addresses do %> + <%= f.label :bcc_addresses, Spree.t(:send_order_mails_in_bcc_to) %>
+ <%= f.text_field :bcc_addresses, class: 'fullwidth' %> + <%= error_message_on :bcc_addresses %> +<% end %> + <%= f.field_container :default_currency do %> <%= f.label :default_currency %> <%= f.select :default_currency, diff --git a/core/app/mailers/spree/base_mailer.rb b/core/app/mailers/spree/base_mailer.rb index 5e4b437ee14..19499c600d2 100644 --- a/core/app/mailers/spree/base_mailer.rb +++ b/core/app/mailers/spree/base_mailer.rb @@ -4,6 +4,10 @@ def from_address(store) store.mail_from_address end + def bcc_addresses(store) + store.bcc_addresses + end + def money(amount, currency = Spree::Config[:currency]) Spree::Money.new(amount, currency: currency).to_s end diff --git a/core/app/mailers/spree/order_mailer.rb b/core/app/mailers/spree/order_mailer.rb index 2c742870e42..265e68c90e4 100644 --- a/core/app/mailers/spree/order_mailer.rb +++ b/core/app/mailers/spree/order_mailer.rb @@ -5,7 +5,7 @@ def confirm_email(order, resend = false) @store = @order.store subject = build_subject(Spree.t('order_mailer.confirm_email.subject'), resend) - mail(to: @order.email, from: from_address(@store), subject: subject) + mail(to: @order.email, from: from_address(@store), bcc: bcc_addresses(@store), subject: subject) end def cancel_email(order, resend = false) diff --git a/core/config/locales/en.yml b/core/config/locales/en.yml index b2abe99f4e7..69007f82bbe 100644 --- a/core/config/locales/en.yml +++ b/core/config/locales/en.yml @@ -1831,6 +1831,7 @@ en: send_copy_of_all_mails_to: Send Copy of All Mails To send_mailer: Send Mailer send_mails_as: Send Mails As + send_order_mails_in_bcc_to: Send confirmation order emails in BCC to server: Server server_error: The server returned an error settings: Settings diff --git a/core/db/migrate/20180124142140_add_mail_bcc_addresses.rb b/core/db/migrate/20180124142140_add_mail_bcc_addresses.rb new file mode 100644 index 00000000000..f8ab39d99bd --- /dev/null +++ b/core/db/migrate/20180124142140_add_mail_bcc_addresses.rb @@ -0,0 +1,5 @@ +class AddMailBccAddresses < ActiveRecord::Migration[5.1] + def change + add_column :spree_stores, :bcc_addresses, :string + end +end