Swap out contact form to one that uses mailgun

This commit is contained in:
rebuilt 2022-11-01 15:51:16 -07:00
parent 6df92d6f88
commit 7f433cf223
17 changed files with 130 additions and 70 deletions

View file

@ -1,4 +1,4 @@
require "active_support/core_ext/integer/time"
require 'active_support/core_ext/integer/time'
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
@ -19,13 +19,13 @@ Rails.application.configure do
# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
if Rails.root.join("tmp/caching-dev.txt").exist?
if Rails.root.join('tmp/caching-dev.txt').exist?
config.action_controller.perform_caching = true
config.action_controller.enable_fragment_cache_logging = true
config.cache_store = :memory_store
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{2.days.to_i}"
'Cache-Control' => "public, max-age=#{2.days.to_i}"
}
else
config.action_controller.perform_caching = false
@ -36,6 +36,12 @@ Rails.application.configure do
# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local
# Local actionmailer delivery method
config.action_mailer.delivery_method = :smtp
# Local actionmailer smpt address and port
config.action_mailer.smtp_settings = { address: '127.0.0.1', port: 1025 }
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false

View file

@ -90,4 +90,14 @@ Rails.application.configure do
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
ActionMailer::Base.smtp_settings = {
:port => ENV['MAILGUN_SMTP_PORT'],
:address => ENV['MAILGUN_SMTP_SERVER'],
:user_name => ENV['MAILGUN_SMTP_LOGIN'],
:password => ENV['MAILGUN_SMTP_PASSWORD'],
:domain => 'edcommonwealth.org', # UPDATE THIS VALUE WITH YOUR OWN APP
:authentication => :plain,
}
ActionMailer::Base.delivery_method = :smtp
end

View file

@ -9,5 +9,7 @@ Rails.application.routes.draw do
resources :construction, only: :index
resources :district_leader, only: :index
resources :contacts, only: %i[new create]
root 'home#index'
end