module JamRuby
  class ProgressMailer < ActionMailer::Base
    include SendGrid
    layout "user_mailer"

    sendgrid_category :use_subject_lines
    sendgrid_unique_args :env => Environment.mode
    default :from => UserMailer::DEFAULT_SENDER

    def send_reminder(batch_set)
      user = batch_set.user

      sendgrid_recipients([user.email])
      sendgrid_substitute('@USERID', [user.id])
      sendgrid_substitute(EmailBatchProgression::VAR_FIRST_NAME, [user.first_name])

      mail(:to => user.email, 
           :subject => batch_set.subject,
           :title => batch_set.title) do |format|
        format.text { render batch_set.sub_type }
        format.html { render batch_set.sub_type }
      end
    end

  end
end
