aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Houston <robin.houston@gmail.com>2011-09-07 11:09:36 +0100
committerRobin Houston <robin.houston@gmail.com>2011-09-07 11:09:36 +0100
commit20b37afbe4925f649409d2f1cdd0bf37607c2e7b (patch)
tree3ff13863fd152292da82acc13ea95ad635062f11
parentf20e9e8f0a1ed1bf0f784ba1fb5a58c97c6f3978 (diff)
Different sender address for track messages
Use the new configuration variables TRACK_SENDER_NAME and TRACK_SENDER_EMAIL to specify the sender address for track messages, which may therefore be different from the general contact address.
-rw-r--r--app/models/application_mailer.rb4
-rw-r--r--app/models/track_mailer.rb6
-rw-r--r--config/general.yml-example4
3 files changed, 12 insertions, 2 deletions
diff --git a/app/models/application_mailer.rb b/app/models/application_mailer.rb
index 9628d7339..e9f82a2c3 100644
--- a/app/models/application_mailer.rb
+++ b/app/models/application_mailer.rb
@@ -15,8 +15,8 @@ class ApplicationMailer < ActionMailer::Base
self.raise_delivery_errors = true
def contact_from_name_and_email
- contact_name = MySociety::Config.get("CONTACT_NAME", 'contact@localhost')
- contact_email = MySociety::Config.get("CONTACT_EMAIL", 'Alaveteli')
+ contact_name = MySociety::Config.get("CONTACT_NAME", 'Alaveteli')
+ contact_email = MySociety::Config.get("CONTACT_EMAIL", 'contact@localhost')
return "#{contact_name} <#{contact_email}>"
end
diff --git a/app/models/track_mailer.rb b/app/models/track_mailer.rb
index 4b7c603a7..92bf93898 100644
--- a/app/models/track_mailer.rb
+++ b/app/models/track_mailer.rb
@@ -26,6 +26,12 @@ class TrackMailer < ApplicationMailer
@body = { :user => user, :email_about_things => email_about_things, :unsubscribe_url => unsubscribe_url }
end
+ def contact_from_name_and_email
+ contact_name = MySociety::Config.get("TRACK_SENDER_NAME", 'Alaveteli')
+ contact_email = MySociety::Config.get("TRACK_SENDER_EMAIL", 'contact@localhost')
+ return "#{contact_name} <#{contact_email}>"
+ end
+
# Send email alerts for tracked things. Never more than one email
# a day, nor about events which are more than a week old, nor
# events about which emails have been sent within the last two
diff --git a/config/general.yml-example b/config/general.yml-example
index 1bb3c1c49..ed39034f7 100644
--- a/config/general.yml-example
+++ b/config/general.yml-example
@@ -60,6 +60,10 @@ ADMIN_PASSWORD: 'passwordx'
CONTACT_EMAIL: 'postmaster@localhost'
CONTACT_NAME: 'Alaveteli Webmaster'
+# Email "from" details for track messages
+TRACK_SENDER_EMAIL: 'postmaster@localhost'
+TRACK_SENDER_NAME: 'Alaveteli Webmaster'
+
# Where the raw incoming email data gets stored; make sure you back
# this up!
RAW_EMAILS_LOCATION: 'files/raw_emails'