class Employee::Communication::Smtp::MailersController < Employee::Controller
  def create
    if params[:recipient].present?
      SmtpMailer.send_message(config, params).deliver
      render_success :ok, message: 'Email has been sent'
    else
      render_error :unprocessable_entity, errors: { recipient: 'Blank Email address' }
    end
  end

  private
    def config
      @config ||= current_school.communication_smtp_config
    end
end
