Class: Livechat::Mailer

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
app/mailers/livechat/mailer.rb

Overview

The two built-in notification emails. Plain text, no branding — they are nudges back into the conversation, not newsletters. Both require config.mailer_from; the callers in Livechat::Notifications enforce the rest of the conditions (recipients present, first unread message).

Instance Method Summary collapse

Instance Method Details

#new_agent_reply(message) ⇒ Object

To the visitor: an agent replied while they were away.



23
24
25
26
27
28
29
30
31
32
# File 'app/mailers/livechat/mailer.rb', line 23

def new_agent_reply(message)
  @message = message
  @conversation = message.conversation

  mail from: Livechat.config.mailer_from,
       to: @conversation.visitor_email,
       subject: I18n.t('livechat.mail.reply_subject',
                       name: message.public_label, app: Livechat.app_name,
                       default: '%{name} replied to you on %{app}')
end

#new_visitor_message(message) ⇒ Object

To the team: a visitor wrote and nobody has read it.



10
11
12
13
14
15
16
17
18
19
20
# File 'app/mailers/livechat/mailer.rb', line 10

def new_visitor_message(message)
  @message = message
  @conversation = message.conversation
  @inbox_url = inbox_url(@conversation)

  mail from: Livechat.config.mailer_from,
       to: Livechat.config.agent_email_list,
       subject: I18n.t('livechat.mail.visitor_subject',
                       name: @conversation.display_name, app: Livechat.app_name,
                       default: '%{name} wrote to you on %{app}')
end