diff --git a/.env.example b/.env.example index bc36e8588..50b2fd1b2 100644 --- a/.env.example +++ b/.env.example @@ -40,6 +40,15 @@ SMTP_AUTHENTICATION= SMTP_ENABLE_STARTTLS_AUTO= # Mail Incoming + +# Set this to appropriate ingress channel with regards to incoming emails +# Possible values are : +# :relay for Exim, Postfix, Qmail +# :mailgun for Mailgun +# :mandrill for Mandrill +# :postmark for Postmark +# :sendgrid for Sendgrid +RAILS_INBOUND_EMAIL_SERVICE= # Use one of the following based on the email ingress service # Ref: https://edgeguides.rubyonrails.org/action_mailbox_basics.html RAILS_INBOUND_EMAIL_PASSWORD= diff --git a/config/environments/development.rb b/config/environments/development.rb index d91144eb1..f1f3174ed 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,9 +1,6 @@ Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - # set this to appropriate ingress channel when you are doing development in local with regards to incoming emails - # config.action_mailbox.ingress = :sendgrid - # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. @@ -64,6 +61,14 @@ Rails.application.configure do config.action_mailer.smtp_settings = smtp_settings + # Set this to appropriate ingress service for which the options are : + # :relay for Exim, Postfix, Qmail + # :mailgun for Mailgun + # :mandrill for Mandrill + # :postmark for Postmark + # :sendgrid for Sendgrid + config.action_mailbox.ingress = ENV.fetch('RAILS_INBOUND_EMAIL_SERVICE', 'relay').to_sym + Rails.application.routes.default_url_options = { host: 'localhost', port: 3000 } # Print deprecation notices to the Rails logger. diff --git a/config/environments/production.rb b/config/environments/production.rb index 6dfb0c400..6eadec2b7 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,14 +1,4 @@ Rails.application.configure do - # Prepare the ingress controller used to receive mail - - # Set this to appropriate ingress service for which the options are : - # :relay for Exim, Postfix, Qmail - # :mailgun for Mailgun - # :mandrill for Mandrill - # :postmark for Postmark - # :sendgrid for Sendgrid - config.action_mailbox.ingress = :sendgrid - # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. @@ -75,12 +65,6 @@ Rails.application.configure do config.active_job.queue_adapter = :sidekiq # config.active_job.queue_name_prefix = "Chatwoot_#{Rails.env}" - config.action_mailer.perform_caching = false - - # Ignore bad email addresses and do not raise email delivery errors. - # Set this to true and configure the email server for immediate delivery to raise delivery errors. - # config.action_mailer.raise_delivery_errors = false - # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true @@ -110,6 +94,12 @@ Rails.application.configure do # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false + config.action_mailer.perform_caching = false + + # Ignore bad email addresses and do not raise email delivery errors. + # Set this to true and configure the email server for immediate delivery to raise delivery errors. + # config.action_mailer.raise_delivery_errors = false + # Chatwoot production settings config.action_mailer.default_url_options = { host: ENV['FRONTEND_URL'] } config.action_mailer.smtp_settings = { @@ -121,5 +111,13 @@ Rails.application.configure do enable_starttls_auto: true } + # Set this to appropriate ingress service for which the options are : + # :relay for Exim, Postfix, Qmail + # :mailgun for Mailgun + # :mandrill for Mandrill + # :postmark for Postmark + # :sendgrid for Sendgrid + config.action_mailbox.ingress = ENV.fetch('RAILS_INBOUND_EMAIL_SERVICE', 'relay').to_sym + Rails.application.routes.default_url_options = { host: ENV['FRONTEND_URL'] } end diff --git a/config/environments/staging.rb b/config/environments/staging.rb index 091c49386..35746997d 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -71,6 +71,14 @@ Rails.application.configure do # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false + # Set this to appropriate ingress service for which the options are : + # :relay for Exim, Postfix, Qmail + # :mailgun for Mailgun + # :mandrill for Mandrill + # :postmark for Postmark + # :sendgrid for Sendgrid + config.action_mailbox.ingress = ENV.fetch('RAILS_INBOUND_EMAIL_SERVICE', 'relay').to_sym + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true diff --git a/docs/development/project-setup/conversation-continuity.md b/docs/development/project-setup/conversation-continuity.md index cf0ce8d54..2dceadc89 100644 --- a/docs/development/project-setup/conversation-continuity.md +++ b/docs/development/project-setup/conversation-continuity.md @@ -19,16 +19,16 @@ With a second step that we have done, we are now introducing the capability of c There are a couple of email infrastructure service providers to handle the incoming emails that we support at the moment. They are Sendgrid, Mandrill, Mailgun, Exim, Postfix, Qmail and Postmark. -Step 1 : We have to set the ingress option in `config/environments/production.rb`. +Step 1 : We have to set the inbound email service used as an environment variable. ```bash # Set this to appropriate ingress service for which the options are : - # :relay for Exim, Postfix, Qmail - # :mailgun for Mailgun - # :mandrill for Mandrill - # :postmark for Postmark - # :sendgrid for Sendgrid - config.action_mailbox.ingress = :sendgrid +# "relay" for Exim, Postfix, Qmail +# "mailgun" for Mailgun +# "mandrill" for Mandrill +# "postmark" for Postmark +# "sendgrid" for Sendgrid +RAILS_INBOUND_EMAIL_SERVICE=relay ``` This configures the ingress service for the app. Now we have to set the password for the ingress service that we use.