Class: Locomotive::Notifications

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
app/mailers/locomotive/notifications.rb

Constant Summary collapse

SMTP_SETTINGS_NAMES =
%w(smtp_settings mailer_settings email_settings).freeze
SMTP_ATTRIBUTES =
%w(address authentication port enable_starttls_auto user_name password domain).freeze

Instance Method Summary collapse

Instance Method Details

#new_content_entry(site, account, entry) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/mailers/locomotive/notifications.rb', line 11

def new_content_entry(site, , entry)
  @site, @account = site, 
  @entry, @type   = entry, entry.content_type
  @domain         = fetch_domain

  subject = new_content_entry_subject(entry, domain: @domain, type: @type.name, locale: .locale)
  from    = fetch_from

  # attach uploaded files
  if @type.public_submission_email_attachments
    entry.file_custom_fields.each do |name|
      next if (file = entry.send(name)&.file).nil?
      attachments[file.filename] = file.read
    end
  end

  mail subject: subject, from: from, to: .email, reply_to: from
end