Class: RadSocialMailer

Inherits:
ApplicationMailer show all
Includes:
Roadie::Rails::Automatic
Defined in:
app/mailers/rad_social_mailer.rb

Instance Method Summary collapse

Instance Method Details

#social_mail(options) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/mailers/rad_social_mailer.rb', line 6

def social_mail(options)
  from_address = Mail::Address.new options[:from] # ex: "[email protected]"
  from_address.display_name = options[:from_name] # ex: "John Doe"

  @from_name = from_address.display_name
  @from_email = from_address
  @message = options[:message]
  @actual_from = ENV.fetch('RAD_SOCIAL_FROM_EMAIL')
  @actual_from = from_address if @actual_from.nil?

  mail({
         to: options[:to],
         from: @actual_from,
         reply_to: @from_email,
         subject: options[:subject],
         text: @message,
         content_type: 'text/html',
       })
end