Class: Jpmobile::Mailer::Base

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
lib/jpmobile/mailer.rb

Instance Method Summary collapse

Instance Method Details

#mail(headers = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/jpmobile/mailer.rb', line 11

def mail(headers = {}, &)
  tos = headers[:to] || self.default_params[:to]
  tos = tos.split(',')

  @mobile = if tos.size == 1
              # for mobile
              (Jpmobile::Email.detect(tos.first) || Jpmobile::Mobile::AbstractMobile).new(nil, nil)
            else
              # for multi to addresses
              Jpmobile::Mobile::AbstractMobile.new(nil, nil)
            end
  self.lookup_context.mobile = @mobile.mail_variants

  @mobile.decorated = headers.delete(:decorated)

  m = super

  m.mobile = @mobile

  # for decorated-mail manipulation
  m.rearrange! if @mobile.decorated?

  m
end