aboutsummaryrefslogtreecommitdiffstats
path: root/app/mailers
diff options
context:
space:
mode:
Diffstat (limited to 'app/mailers')
-rw-r--r--app/mailers/contact_mailer.rb27
-rw-r--r--app/mailers/info_request_batch_mailer.rb25
2 files changed, 48 insertions, 4 deletions
diff --git a/app/mailers/contact_mailer.rb b/app/mailers/contact_mailer.rb
index 4dc49bf8b..27e04ca4b 100644
--- a/app/mailers/contact_mailer.rb
+++ b/app/mailers/contact_mailer.rb
@@ -34,12 +34,31 @@ class ContactMailer < ApplicationMailer
end
# Send message to a user from the administrator
- def from_admin_message(recipient_user, subject, message)
- @message, @from_user, @recipient_user = message, contact_from_name_and_email, recipient_user
-
+ def from_admin_message(recipient_name, recipient_email, subject, message)
+ @message, @from_user = message, contact_from_name_and_email
+ @recipient_name, @recipient_email = recipient_name, recipient_email
mail(:from => contact_from_name_and_email,
- :to => recipient_user.name_and_email,
+ :to => MailHandler.address_from_name_and_email(@recipient_name, @recipient_email),
:bcc => AlaveteliConfiguration::contact_email,
:subject => subject)
end
+
+ # Send a request to the administrator to add an authority
+ def add_public_body(change_request)
+ @change_request = change_request
+ mail(:from => MailHandler.address_from_name_and_email(@change_request.get_user_name, @change_request.get_user_email),
+ :to => contact_from_name_and_email,
+ :subject => _('Add authority - {{public_body_name}}',
+ :public_body_name => @change_request.get_public_body_name))
+ end
+
+ # Send a request to the administrator to update an authority email address
+ def update_public_body_email(change_request)
+ @change_request = change_request
+ mail(:from => MailHandler.address_from_name_and_email(@change_request.get_user_name, @change_request.get_user_email),
+ :to => contact_from_name_and_email,
+ :subject => _('Update email address - {{public_body_name}}',
+ :public_body_name => @change_request.get_public_body_name))
+ end
+
end
diff --git a/app/mailers/info_request_batch_mailer.rb b/app/mailers/info_request_batch_mailer.rb
new file mode 100644
index 000000000..a2becfb24
--- /dev/null
+++ b/app/mailers/info_request_batch_mailer.rb
@@ -0,0 +1,25 @@
+# models/info_request_batch_mailer.rb:
+# Emails relating to user accounts. e.g. Confirming a new account
+#
+# Copyright (c) 2013 UK Citizens Online Democracy. All rights reserved.
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
+
+class InfoRequestBatchMailer < ApplicationMailer
+
+ def batch_sent(info_request_batch, unrequestable, user)
+ @info_request_batch, @unrequestable = info_request_batch, unrequestable
+ headers('Return-Path' => blackhole_email, 'Reply-To' => contact_from_name_and_email)
+
+ # Make a link going to the info request batch page, which logs the user in.
+ post_redirect = PostRedirect.new(
+ :uri => info_request_batch_url(@info_request_batch),
+ :user_id => info_request_batch.user_id)
+ post_redirect.save!
+ @url = confirm_url(:email_token => post_redirect.email_token)
+
+ mail(:from => contact_from_name_and_email,
+ :to => user.name_and_email,
+ :subject => _("Your batch request \"{{title}}\" has been sent",
+ :title => info_request_batch.title))
+ end
+end