diff options
-rw-r--r-- | app/models/application_mailer.rb | 6 | ||||
-rw-r--r-- | app/models/contact_mailer.rb | 5 | ||||
-rw-r--r-- | app/models/request_mailer.rb | 5 | ||||
-rw-r--r-- | app/models/track_mailer.rb | 3 | ||||
-rw-r--r-- | app/models/user_mailer.rb | 4 | ||||
-rw-r--r-- | config/general-example | 5 |
6 files changed, 18 insertions, 10 deletions
diff --git a/app/models/application_mailer.rb b/app/models/application_mailer.rb index 32c6ced26..8ee467b60 100644 --- a/app/models/application_mailer.rb +++ b/app/models/application_mailer.rb @@ -4,7 +4,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: application_mailer.rb,v 1.7 2008-04-03 15:29:51 francis Exp $ +# $Id: application_mailer.rb,v 1.8 2009-02-09 10:37:12 francis Exp $ class ApplicationMailer < ActionMailer::Base # Include all the functions views get, as emails call similar things. @@ -18,6 +18,10 @@ class ApplicationMailer < ActionMailer::Base "WhatDoTheyKnow <"+MySociety::Config.get("CONTACT_EMAIL", 'contact@localhost')+">" end + def blackhole_email + MySociety::Config.get("BLACKHOLE_PREFIX", 'do-not-reply-to-this-address')+"@"+MySociety::Config.get("INCOMING_EMAIL_DOMAIN", "localhost") + end + # URL generating functions are needed by all controllers (for redirects), # views (for links) and mailers (for use in emails), so include them into # all of all. diff --git a/app/models/contact_mailer.rb b/app/models/contact_mailer.rb index 179e00c54..0390fc347 100644 --- a/app/models/contact_mailer.rb +++ b/app/models/contact_mailer.rb @@ -4,7 +4,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: contact_mailer.rb,v 1.9 2008-10-07 22:05:06 francis Exp $ +# $Id: contact_mailer.rb,v 1.10 2009-02-09 10:37:12 francis Exp $ class ContactMailer < ApplicationMailer @@ -31,8 +31,7 @@ class ContactMailer < ApplicationMailer @from = from_user.name_and_email # Do not set envelope from address to the from_user, so they can't get # someone's email addresses from transitory bounce messages. - headers 'Return-Path' => contact_from_name_and_email, # XXX perhaps change to being a black hole - 'Reply-To' => @from + headers 'Return-Path' => blackhole_email, 'Reply-To' => @from @recipients = recipient_user.name_and_email @subject = subject @body = { diff --git a/app/models/request_mailer.rb b/app/models/request_mailer.rb index bf9327546..59ab3da3d 100644 --- a/app/models/request_mailer.rb +++ b/app/models/request_mailer.rb @@ -4,7 +4,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: request_mailer.rb,v 1.67 2008-11-21 01:50:06 francis Exp $ +# $Id: request_mailer.rb,v 1.68 2009-02-09 10:37:12 francis Exp $ class RequestMailer < ApplicationMailer @@ -89,6 +89,7 @@ class RequestMailer < ApplicationMailer # Incoming message arrived for a request, but new responses have been stopped. def stopped_responses(info_request, email) @from = contact_from_name_and_email + headers 'Return-Path' => blackhole_email, 'Reply-To' => @from # we don't care about bounces, likely from spammers @recipients = email.from_addrs[0].quoted_full @subject = "Your response to an FOI request was not delivered" attachment :content_type => 'message/rfc822', :body => email.body @@ -170,7 +171,7 @@ class RequestMailer < ApplicationMailer @body = { :incoming_message => incoming_message, :info_request => info_request, :url => url } end - # Tell the requester that they need to clarify their request + # Tell requester that somebody add an annotation to their request def comment_on_alert(info_request, comment) @from = contact_from_name_and_email @recipients = info_request.user.name_and_email diff --git a/app/models/track_mailer.rb b/app/models/track_mailer.rb index 732217e39..36feb707c 100644 --- a/app/models/track_mailer.rb +++ b/app/models/track_mailer.rb @@ -4,7 +4,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: track_mailer.rb,v 1.13 2008-09-12 08:26:04 francis Exp $ +# $Id: track_mailer.rb,v 1.14 2009-02-09 10:37:12 francis Exp $ class TrackMailer < ApplicationMailer def event_digest(user, email_about_things) @@ -15,6 +15,7 @@ class TrackMailer < ApplicationMailer unsubscribe_url = confirm_url(:email_token => post_redirect.email_token) @from = contact_from_name_and_email + headers 'Return-Path' => blackhole_email, 'Reply-To' => @from # we don't care about bounces for tracks @recipients = user.name_and_email @subject = "Your WhatDoTheyKnow.com email alert" @body = { :user => user, :email_about_things => email_about_things, :unsubscribe_url => unsubscribe_url } diff --git a/app/models/user_mailer.rb b/app/models/user_mailer.rb index e4d56b68a..06a115c5b 100644 --- a/app/models/user_mailer.rb +++ b/app/models/user_mailer.rb @@ -4,11 +4,12 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: user_mailer.rb,v 1.7 2008-02-28 12:29:43 francis Exp $ +# $Id: user_mailer.rb,v 1.8 2009-02-09 10:37:12 francis Exp $ class UserMailer < ApplicationMailer def confirm_login(user, reasons, url) @from = contact_from_name_and_email + headers 'Return-Path' => blackhole_email, 'Reply-To' => @from # we don't care about bounces when people are fiddling with their account @recipients = user.name_and_email @subject = reasons[:email_subject] @body[:reasons] = reasons @@ -18,6 +19,7 @@ class UserMailer < ApplicationMailer def already_registered(user, reasons, url) @from = contact_from_name_and_email + headers 'Return-Path' => blackhole_email, 'Reply-To' => @from # we don't care about bounces when people are fiddling with their account @recipients = user.name_and_email @subject = reasons[:email_subject] @body[:reasons] = reasons diff --git a/config/general-example b/config/general-example index 17bbd2e95..70345400d 100644 --- a/config/general-example +++ b/config/general-example @@ -19,7 +19,7 @@ * Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. * Email: francis@mysociety.org; WWW: http://www.mysociety.org * - * $Id: general-example,v 1.17 2008-10-17 11:46:11 francis Exp $ + * $Id: general-example,v 1.18 2009-02-09 10:37:13 francis Exp $ * */ @@ -32,7 +32,8 @@ define('OPTION_DOMAIN', '127.0.0.1:3000'); // Incoming email define('OPTION_INCOMING_EMAIL_DOMAIN', 'localhost'); // e.g. 'foifa.com' define('OPTION_INCOMING_EMAIL_PREFIX', ''); // e.g. 'foi+' -define('OPTION_INCOMING_EMAIL_SECRET', 'xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx'); // Used for hash in request email address +define('OPTION_INCOMING_EMAIL_SECRET', 'xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx'); // used for hash in request email address +define('OPTION_BLACKHOLE_PREFIX', 'do-not-reply-to-this-address'); // used as envelope from at the incoming email domain for cases where we don't care about failure // Administration define('OPTION_CONTACT_EMAIL', 'admin@localhost'); |