cda65ea339
* Clean up the mailers * Disable assignment mailer if setting is turned off * Email notifications on conversation create * Specs
21 lines
807 B
Ruby
21 lines
807 B
Ruby
class AgentNotifications::ConversationNotificationsMailer < ApplicationMailer
|
|
default from: ENV.fetch('MAILER_SENDER_EMAIL', 'accounts@chatwoot.com')
|
|
layout 'mailer'
|
|
|
|
def conversation_created(conversation, agent)
|
|
return unless smtp_config_set_or_development?
|
|
|
|
@agent = agent
|
|
@conversation = conversation
|
|
subject = "#{@agent.name}, A new conversation [ID - #{@conversation.display_id}] has been created in #{@conversation.inbox&.name}."
|
|
mail(to: @agent.email, subject: subject)
|
|
end
|
|
|
|
def conversation_assigned(conversation, agent)
|
|
return unless smtp_config_set_or_development?
|
|
|
|
@agent = agent
|
|
@conversation = conversation
|
|
mail(to: @agent.email, subject: "#{@agent.name}, A new conversation [ID - #{@conversation.display_id}] has been assigned to you.")
|
|
end
|
|
end
|