Class: Spree::BaseMailer

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
app/mailers/spree/base_mailer.rb

Instance Method Summary collapse

Instance Method Details

#current_storeObject



5
6
7
# File 'app/mailers/spree/base_mailer.rb', line 5

def current_store
  @current_store ||= @order&.store.presence || Spree::Store.current || Spree::Store.default
end

#from_addressObject



11
12
13
# File 'app/mailers/spree/base_mailer.rb', line 11

def from_address
  current_store.mail_from_address
end

#frontend_available?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'app/mailers/spree/base_mailer.rb', line 25

def frontend_available?
  Spree::Core::Engine.frontend_available?
end

#mail(headers = {}, &block) ⇒ Object



30
31
32
33
34
# File 'app/mailers/spree/base_mailer.rb', line 30

def mail(headers = {}, &block)
  ensure_default_action_mailer_url_host(headers[:store_url])
  set_email_locale
  super if Spree::Config[:send_core_emails]
end

#money(amount, currency = nil) ⇒ Object



19
20
21
22
# File 'app/mailers/spree/base_mailer.rb', line 19

def money(amount, currency = nil)
  currency ||= current_store.default_currency
  Spree::Money.new(amount, currency: currency).to_s
end

#reply_to_addressObject



15
16
17
# File 'app/mailers/spree/base_mailer.rb', line 15

def reply_to_address
  current_store.mail_from_address
end