Files
openfoodnetwork/app/mailers/enterprise_mailer.rb
drummer83 40fbdc596a 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
2025-02-10 21:51:04 +01:00

37 lines
1.0 KiB
Ruby

# frozen_string_literal: true
require 'devise/mailers/helpers'
class EnterpriseMailer < ApplicationMailer
include Devise::Mailers::Helpers
include I18nHelper
def welcome(enterprise)
@enterprise = enterprise
I18n.with_locale valid_locale(@enterprise.owner) do
subject = t('enterprise_mailer.welcome.subject',
enterprise: @enterprise.name,
sitename: Spree::Config[:site_name])
mail(to: enterprise.contact.email,
subject:)
end
end
def manager_invitation(enterprise, user)
@enterprise = enterprise
@instance = Spree::Config[:site_name]
I18n.with_locale valid_locale(@enterprise.owner) do
subject = t('enterprise_mailer.invite_manager.subject', enterprise: @enterprise.name)
mail(to: user.email,
subject:,
reply_to: @enterprise.contact.email)
end
end
private
def find_enterprise(enterprise)
@enterprise = enterprise.is_a?(Enterprise) ? enterprise : Enterprise.find(enterprise)
end
end