Sha256: 76e49f67d679159cb00ac3eeaa14ed36d3add4df762c3f3102a44e925efdba85

Contents?: true

Size: 870 Bytes

Versions: 21

Compression:

Stored size: 870 Bytes

Contents

# frozen_string_literal: true

module NeetoCommonsBackend
  module Initializers
    class << self
      def email_setup
        Premailer::Rails.config.merge!(preserve_styles: true, remove_ids: true)

        ActionMailer::Base.default_url_options[:host] = Rails.application.secrets.host

        ActionMailer::Base.delivery_method = Rails.application.config.action_mailer.delivery_method

        ActionMailer::Base.asset_host = Rails.application.secrets.host

        if ActionMailer::Base.delivery_method == :smtp
          ActionMailer::Base.smtp_settings = Rails.application.secrets.mailer[:smtp_settings].symbolize_keys
        end

        if Rails.env.production? && ENV["APP_URL"].blank?
          raise "URLs in email use APP_URL. This is not set. Please fix it by adding APP_URL env in the format app.neetoappname.com"
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
neeto-commons-backend-1.0.109 lib/neeto_commons_backend/initializers/email_setup.rb
neeto-commons-backend-1.0.108 lib/neeto_commons_backend/initializers/email_setup.rb
neeto-commons-backend-1.0.107 lib/neeto_commons_backend/initializers/email_setup.rb
neeto-commons-backend-1.0.106 lib/neeto_commons_backend/initializers/email_setup.rb
neeto-commons-backend-1.0.105 lib/neeto_commons_backend/initializers/email_setup.rb
neeto-commons-backend-1.0.104 lib/neeto_commons_backend/initializers/email_setup.rb
neeto-commons-backend-1.0.103 lib/neeto_commons_backend/initializers/email_setup.rb
neeto-commons-backend-1.0.102 lib/neeto_commons_backend/initializers/email_setup.rb
neeto-commons-backend-1.0.101 lib/neeto_commons_backend/initializers/email_setup.rb
neeto-commons-backend-1.0.100 lib/neeto_commons_backend/initializers/email_setup.rb
neeto-commons-backend-1.0.99 lib/neeto_commons_backend/initializers/email_setup.rb
neeto-commons-backend-1.0.98 lib/neeto_commons_backend/initializers/email_setup.rb
neeto-commons-backend-1.0.97 lib/neeto_commons_backend/initializers/email_setup.rb
neeto-commons-backend-1.0.96 lib/neeto_commons_backend/initializers/email_setup.rb
neeto-commons-backend-1.0.95 lib/neeto_commons_backend/initializers/email_setup.rb
neeto-commons-backend-1.0.94 lib/neeto_commons_backend/initializers/email_setup.rb
neeto-commons-backend-1.0.93 lib/neeto_commons_backend/initializers/email_setup.rb
neeto-commons-backend-1.0.92 lib/neeto_commons_backend/initializers/email_setup.rb
neeto-commons-backend-1.0.91 lib/neeto_commons_backend/initializers/email_setup.rb
neeto-commons-backend-1.0.90 lib/neeto_commons_backend/initializers/email_setup.rb