diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/contact_mailer.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/app/models/contact_mailer.rb b/app/models/contact_mailer.rb index 77854a4ef..de6a6ee58 100644 --- a/app/models/contact_mailer.rb +++ b/app/models/contact_mailer.rb @@ -4,9 +4,11 @@ # 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.3 2008-02-20 12:51:29 francis Exp $ +# $Id: contact_mailer.rb,v 1.4 2008-03-12 13:01:04 francis Exp $ class ContactMailer < ApplicationMailer + + # Send message to administrator def message(name, email, subject, message, request_details) @from = name + " <" + email + ">" @recipients = contact_from_name_and_email @@ -15,4 +17,22 @@ class ContactMailer < ApplicationMailer :request_details => request_details } end + + # Send message to another user + def user_message(from_user, recipient_user, recipient_url,subject, message) + @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 'Sender' => contact_from_name_and_email, # XXX perhaps change to being a black hole + 'Reply-To' => @from + @recipients = recipient_user.name_and_email + @subject = subject + @body = { + :message => message, + :from_user => from_user, + :recipient_user => recipient_user, + :recipient_url => recipient_url + } + end + end |