diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 1dbc5baa2..ea1d4fa40 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,5 +1,5 @@ class ApplicationMailer < ActionMailer::Base helper :settings - default from: "Consul " + default from: "#{Setting['mailer_from_name']} <#{Setting['mailer_from_address']}>" layout 'mailer' end diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index edabf24d4..a6deae2a7 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -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 = 'noreply@consul.es' + config.mailer_sender = "#{Setting['mailer_from_name']} <#{Setting['mailer_from_address']}>" # Configure the class responsible to send e-mails. config.mailer = 'DeviseMailer' diff --git a/db/dev_seeds.rb b/db/dev_seeds.rb index 02e5f9f6d..631ae0f04 100644 --- a/db/dev_seeds.rb +++ b/db/dev_seeds.rb @@ -32,6 +32,8 @@ Setting.create(key: 'feature.facebook_login', value: "true") Setting.create(key: 'feature.google_login', value: "true") Setting.create(key: 'per_page_code', value: "") 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" ('A'..'Z').each { |i| Geozone.create(name: "District #{i}", external_code: i.ord, census_code: i.ord) } diff --git a/db/seeds.rb b/db/seeds.rb index 1607a0aff..73d8153ca 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -81,3 +81,8 @@ Setting['banner-img.banner-img-three'] = "Banner image 3" # Proposal notifications Setting['proposal_notification_minimum_interval_in_days'] = 3 Setting['direct_message_max_per_day'] = 3 + +# Email settings +Setting['mailer_from_name'] = 'Consul' +Setting['mailer_from_address'] = 'noreply@consul.es' +