Class: Collavre::InboxMailer

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

Instance Method Summary collapse

Instance Method Details

#daily_summaryObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/mailers/collavre/inbox_mailer.rb', line 3

def daily_summary
  @user = params[:user]
  @items = params[:items]
  locale = @user.locale.presence || I18n.default_locale.to_s
  email = I18n.with_locale(locale) do
    mail to: @user.email, subject: I18n.t("collavre.inbox_mailer.daily_summary.subject")
  end
  Collavre::Email.create!(
    user: @user,
    email: @user.email,
    subject: email.subject,
    body: extract_body(email),
    event: :inbox_summary
  )
end