diff --git a/lib/tasks/podmin.rake b/lib/tasks/podmin.rake new file mode 100644 index 000000000..f48f042a3 --- /dev/null +++ b/lib/tasks/podmin.rake @@ -0,0 +1,29 @@ +namespace :podmin do + + desc < :environment do |t, args| + if args[:users_def] == 'all' + # to all except deleted and deactivated, of course + users = User.where(locked_at: nil) + elsif args[:users_def] == 'active_yearly' + users = User.yearly_actives + elsif args[:users_def] == 'active_monthly' + users = User.monthly_actives + elsif args[:users_def] == 'active_halfyear' + users = User.halfyear_actives + end + file = File.open(args[:msg_path]) + msg = file.read + file.close + mails = Notifier.admin(msg.html_safe, users) + mails.each(&:deliver) + end + +end \ No newline at end of file