hack-the-arch icon indicating copy to clipboard operation
hack-the-arch copied to clipboard

Feature: ability for admin to send e-mail to signed up users

Open paullj1 opened this issue 8 years ago • 2 comments

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] ".

paullj1 avatar Jul 13 '17 13:07 paullj1

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

RCydefe avatar Feb 15 '18 15:02 RCydefe

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.

paullj1 avatar Feb 17 '18 22:02 paullj1