Class: AccountMailer

Inherits:
ApplicationMailer show all
Defined in:
app/mailers/account_mailer.rb

Overview

ActionMailer: account.

Instance Method Summary collapse

Methods inherited from ApplicationMailer

#null_mail

Instance Method Details

#created_account(id, _options = {}) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/mailers/account_mailer.rb', line 27

def (id, _options = {})
  @account = Account.find(id)
  @contact = @account.party if @account.party.is_contact?
  @customer = @account.party.customer
  notify_emails = []
  notify_emails << @account.party.customer..email if @account.party.is_contact? && @account.party.customer.present? && @account.party.customer..present? && @account.party.customer..email.present?
  notify_emails << @customer.primary_sales_rep.email if @customer.primary_sales_rep.present? && @customer.primary_sales_rep.email.present?
  notify_emails << @customer.secondary_sales_rep.email if @customer.secondary_sales_rep.present? && @customer.secondary_sales_rep.email.present?
  return if notify_emails.blank?

  mail to: notify_emails, subject: "WarmlyYours online account/login created linked to customer #{@customer.name} (ID: CN#{@customer.id})"
end

#email_changed(id, old_email, old_login, notify_email, options = {}) ⇒ Object



14
15
16
17
18
19
20
# File 'app/mailers/account_mailer.rb', line 14

def email_changed(id, old_email, , notify_email, options = {})
  @account = Account.find(id)
  @old_login = 
  @old_email = old_email
  @options = options
  mail to: notify_email, subject: "Your WarmlyYours online account e-mail was changed"
end

#password_changed(id, options = {}) ⇒ Object



8
9
10
11
12
# File 'app/mailers/account_mailer.rb', line 8

def password_changed(id, options = {})
  @account = Account.find(id)
  @options = options
  mail to: @account.email, subject: "Your WarmlyYours online account password was changed"
end

#username_reminder(email, logins) ⇒ Object



22
23
24
25
# File 'app/mailers/account_mailer.rb', line 22

def username_reminder(email, logins)
  @logins = logins
  mail to: email, subject: "Your WarmlyYours username(s)"
end