aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/track_mailer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/track_mailer.rb')
-rw-r--r--app/models/track_mailer.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/track_mailer.rb b/app/models/track_mailer.rb
index f8bef4d61..85b1fedd8 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
@@ -40,6 +46,8 @@ class TrackMailer < ApplicationMailer
return false
end
for user in users
+ next if !user.should_be_emailed?
+
email_about_things = []
track_things = TrackThing.find(:all, :conditions => [ "tracking_user_id = ? and track_medium = ?", user.id, 'email_daily' ])
for track_thing in track_things