Extract mailer from name and address to a setting

This commit is contained in:
Fernando Blat
2016-12-23 11:28:53 +01:00
parent d0f6db97d8
commit a07fbc5b41
4 changed files with 9 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
class ApplicationMailer < ActionMailer::Base class ApplicationMailer < ActionMailer::Base
helper :settings helper :settings
default from: "Consul <no-reply@consul.es>" default from: "#{Setting['mailer_from_name']} <#{Setting['mailer_from_address']}>"
layout 'mailer' layout 'mailer'
end end

View File

@@ -12,7 +12,7 @@ Devise.setup do |config|
# Configure the e-mail address which will be shown in Devise::Mailer, # 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 # note that it will be overwritten if you use your own mailer class
# with default "from" parameter. # with default "from" parameter.
config.mailer_sender = 'noreply@consul.es' config.mailer_sender = "#{Setting['mailer_from_name']} <#{Setting['mailer_from_address']}>"
# Configure the class responsible to send e-mails. # Configure the class responsible to send e-mails.
config.mailer = 'DeviseMailer' config.mailer = 'DeviseMailer'

View File

@@ -32,6 +32,8 @@ Setting.create(key: 'feature.facebook_login', value: "true")
Setting.create(key: 'feature.google_login', value: "true") Setting.create(key: 'feature.google_login', value: "true")
Setting.create(key: 'per_page_code', value: "") Setting.create(key: 'per_page_code', value: "")
Setting.create(key: 'comments_body_max_length', value: '1000') Setting.create(key: 'comments_body_max_length', value: '1000')
Setting.create(key: 'mailer_from_name', value: 'Consul')
Setting.create(key: 'mailer_from_address', value: 'noreply@consul.es')
puts "Creating Geozones" puts "Creating Geozones"
('A'..'Z').each { |i| Geozone.create(name: "District #{i}", external_code: i.ord, census_code: i.ord) } ('A'..'Z').each { |i| Geozone.create(name: "District #{i}", external_code: i.ord, census_code: i.ord) }

View File

@@ -81,3 +81,8 @@ Setting['banner-img.banner-img-three'] = "Banner image 3"
# Proposal notifications # Proposal notifications
Setting['proposal_notification_minimum_interval_in_days'] = 3 Setting['proposal_notification_minimum_interval_in_days'] = 3
Setting['direct_message_max_per_day'] = 3 Setting['direct_message_max_per_day'] = 3
# Email settings
Setting['mailer_from_name'] = 'Consul'
Setting['mailer_from_address'] = 'noreply@consul.es'