From 40fbdc596a4f3388d181f2da4b9b71dc44016bd9 Mon Sep 17 00:00:00 2001 From: drummer83 Date: Tue, 30 Jan 2024 22:02:28 +0100 Subject: [PATCH] Add a 'reply to' email address where it makes sense and has been missing until now This includes the following emails: Manager invitation email: reply to inviting enterprise Authorize payment email: reply to distributor Order cancellation email: reply to distributor Shipment notification email: reply to distributor --- app/mailers/enterprise_mailer.rb | 3 ++- app/mailers/payment_mailer.rb | 9 ++++++--- app/mailers/spree/order_mailer.rb | 3 ++- app/mailers/spree/shipment_mailer.rb | 5 ++++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/mailers/enterprise_mailer.rb b/app/mailers/enterprise_mailer.rb index c64907cf6a..95a888e229 100644 --- a/app/mailers/enterprise_mailer.rb +++ b/app/mailers/enterprise_mailer.rb @@ -23,7 +23,8 @@ class EnterpriseMailer < ApplicationMailer I18n.with_locale valid_locale(@enterprise.owner) do subject = t('enterprise_mailer.invite_manager.subject', enterprise: @enterprise.name) mail(to: user.email, - subject:) + subject:, + reply_to: @enterprise.contact.email) end end diff --git a/app/mailers/payment_mailer.rb b/app/mailers/payment_mailer.rb index ae38604b98..97db37e053 100644 --- a/app/mailers/payment_mailer.rb +++ b/app/mailers/payment_mailer.rb @@ -5,10 +5,13 @@ class PaymentMailer < ApplicationMailer def authorize_payment(payment) @payment = payment + @order = @payment.order subject = I18n.t('spree.payment_mailer.authorize_payment.subject', - distributor: @payment.order.distributor.name) - I18n.with_locale valid_locale(@payment.order.user) do - mail(to: payment.order.email, subject:) + distributor: @order.distributor.name) + I18n.with_locale valid_locale(@order.user) do + mail(to: @order.email, + subject:, + reply_to: @order.distributor.contact.email) end end diff --git a/app/mailers/spree/order_mailer.rb b/app/mailers/spree/order_mailer.rb index 97ffd3f6b1..e4d886d3e9 100644 --- a/app/mailers/spree/order_mailer.rb +++ b/app/mailers/spree/order_mailer.rb @@ -13,7 +13,8 @@ module Spree @order = find_order(order_or_order_id) I18n.with_locale valid_locale(@order.user) do mail(to: @order.email, - subject: mail_subject(t('spree.order_mailer.cancel_email.subject'), resend)) + subject: mail_subject(t('spree.order_mailer.cancel_email.subject'), resend), + reply_to: @order.distributor.contact.email) end end diff --git a/app/mailers/spree/shipment_mailer.rb b/app/mailers/spree/shipment_mailer.rb index 0be7b55cca..7b9216335b 100644 --- a/app/mailers/spree/shipment_mailer.rb +++ b/app/mailers/spree/shipment_mailer.rb @@ -5,8 +5,11 @@ module Spree def shipped_email(shipment, delivery:) @shipment = shipment.respond_to?(:id) ? shipment : Spree::Shipment.find(shipment) @delivery = delivery + @order = @shipment.order subject = base_subject - mail(to: @shipment.order.email, subject:) + mail(to: @order.email, + subject:, + reply_to: @order.distributor.contact.email) end private