Class: EmployeeMailer

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

Instance Method Summary collapse

Instance Method Details

#invitation(employee:, link:) ⇒ Object



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

def invitation(employee:, link:)
  # disable in production as we're not yet processing payroll
  Rails.logger.info("EmployeeMailer.invitation: #{employee.inspect}")
  return if Rails.env.production?

  user = employee.erp_user

  @email = user.email
  @employee_name = user.user_name
  @link = link

  @company_name = employee.company.company_name

  I18n.with_locale(user.locale) do
    mail(
      to: user.email,
      subject: I18n.t('emails.employee_invitation.subject', company_name: @company_name),
      from: Rails.application.config.from_email_address
    )
  end
end