mcpa-stlouis / hack-the-arch

Welcome to HackTheArch! A free open source scoring server for cyber Capture the Flag competitions!
https://hackthearch.herokuapp.com
MIT License
67 stars 28 forks source link

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

Open paullj1 opened 7 years ago

paullj1 commented 7 years ago

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

RCydefe commented 6 years ago

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 => "my_email@example.com", :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

paullj1 commented 6 years ago

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.