Chore: Ability to configure Mailer sender emails [#339] (#342)

* Chore: Ability to configure Mailer sender emails [#339]

fixes : #339
fixes : #330

* update the documentation
This commit is contained in:
Sojan Jose 2019-12-03 22:54:08 +05:30 committed by Pranav Raj S
parent a8e8416d48
commit 6a2f4e6673
7 changed files with 13 additions and 5 deletions

View file

@ -4,7 +4,7 @@ FB_APP_SECRET=
FB_APP_ID=
#mail
MAILER_SENDER_EMAIL=
SMTP_ADDRESS=
SMTP_USERNAME=
SMTP_PASSWORD=

View file

@ -15,6 +15,13 @@ Style/SymbolArray:
Metrics/BlockLength:
Exclude:
- spec/**/*
- '**/routes.rb'
Rails/ApplicationController:
Exclude:
- 'app/controllers/api/v1/widget/messages_controller.rb'
- 'app/controllers/dashboard_controller.rb'
- 'app/controllers/widget_tests_controller.rb'
- 'app/controllers/widgets_controller.rb'
Style/ClassAndModuleChildren:
EnforcedStyle: compact
RSpec/NestedGroups:

View file

@ -1,5 +1,5 @@
class ApplicationMailer < ActionMailer::Base
default from: 'accounts@chatwoot.com'
default from: ENV.fetch('MAILER_SENDER_EMAIL', 'accounts@chatwoot.com')
layout 'mailer'
# helpers

View file

@ -1,5 +1,5 @@
class AssignmentMailer < ApplicationMailer
default from: 'accounts@chatwoot.com'
default from: ENV.fetch('MAILER_SENDER_EMAIL', 'accounts@chatwoot.com')
layout 'mailer'
def conversation_assigned(conversation, agent)

View file

@ -12,7 +12,7 @@ Devise.setup do |config|
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class
# with default "from" parameter.
config.mailer_sender = 'accounts@chatwoot.com'
config.mailer_sender = ENV.fetch('MAILER_SENDER_EMAIL', 'accounts@chatwoot.com')
# Configure the class responsible to send e-mails.
# config.mailer = 'Devise::Mailer'

View file

@ -35,6 +35,7 @@ For development, you don't need an email provider. Chatwoot uses [letter-opener]
For production use, use the following variables to set SMTP server.
```bash
MAILER_SENDER_EMAIL=
SMTP_ADDRESS=
SMTP_USERNAME=
SMTP_PASSWORD=

View file

@ -15,7 +15,7 @@ RSpec.describe 'Confirmation Instructions', type: :mailer do
end
it 'uses the user\'s name' do
expect(mail.body).to match("Welcome, #{confirmable_user.name}!")
expect(mail.body).to match("Welcome, #{CGI.escapeHTML(confirmable_user.name)}!")
end
it 'does not refer to the inviter and their account' do