class EmailsController < ApplicationController
before_filter :authorize

  def index
    
  end
  def daily_reminder
    ActionMailer::Base.default_url_options[:host] = request.host_with_port 
    @mail =NewsMailer.daily_reminder(current_user.id)
    if params[:send]
      usr=User.where(:flag_getemails => true)
      usr.each do |u|
        NewsMailer.daily_reminder(current_user.id).deliver
      end
    end
    render layout: false
end
  protected
  def authorize
    authorize! :emails, User
  end
end
