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



40
41
42
43
44
45
46
47
48
49
50
51
# File 'app/mailers/account_mailer.rb', line 40

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 = {}) ⇒ Mail::Message

Notifies that the online account e-mail was changed.

Parameters:

  • id (Integer)

    the Account id

  • old_email (String)

    the previous e-mail address

  • old_login (String)

    the previous login

  • notify_email (String)

    the address to notify

  • options (Hash) (defaults to: {})

    extra data exposed to the view as @options

Options Hash (options):

  • :reserved (Object)

    reserved for future use — no keys are currently read

Returns:

  • (Mail::Message)


27
28
29
30
31
32
33
# File 'app/mailers/account_mailer.rb', line 27

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 = {}) ⇒ Mail::Message

Notifies the account holder that their online account password was changed.

Parameters:

  • id (Integer)

    the Account id

  • options (Hash) (defaults to: {})

    extra data exposed to the view as @options

Options Hash (options):

  • :reserved (Object)

    reserved for future use — no keys are currently read

Returns:

  • (Mail::Message)


13
14
15
16
17
# File 'app/mailers/account_mailer.rb', line 13

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



35
36
37
38
# File 'app/mailers/account_mailer.rb', line 35

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