hack-the-arch
hack-the-arch copied to clipboard
Feature: ability for admin to send e-mail to signed up users
Should have a form in the settings page that allows the admin to send an e-mail to all active users. Form should have two text areas:
Subject: Message:
E-mail should prepend the subject with "[competition_name] ".
Here is a starting point that i found for this feature.
def send @newsletter = Newsletter.find(:params['id']) @recipients = Recipient.all @recipients.each do |recipient| Newsletter.newsletter_email(recipient, @newsletter).deliver end end
class Newsletter < ActionMailer::Base default :from => "[email protected]", :content_type => "multipart/mixed"
def newsletter_email(recipient, newsletter) # these are instance variables for newsletter view @newsletter = newsletter @recipient = recipient mail(:to => recipient.email, :subject => newsletter.subject) end end
Yup! Logic isn't that difficult. It's more going to be implementing the view in the admin interface and creating the model to support it.