class SMTPListener
  def project_create(project, current_user)
    SMTPMailer.project_create(project, current_user).deliver_later if smtp_enabled
  end

  def order_create(_order, _current_user)
    return nil unless smtp_enabled
  end

  def project_approval_update(_project)
    return nil unless smtp_enabled
  end

  def smtp_enabled
    @smtp_enabled ||= (Setting[:smtp_enabled].nil?) ? false : Setting[:smtp_enabled]
  end
end

class SMTPListener
  def project_create(project, current_user)
    SMTPMailer.project_create(project, current_user).deliver_later if smtp_enabled
  end

  def order_create(_order, _current_user)
    return nil unless smtp_enabled
  end

  def project_approval_update(_project)
    return nil unless smtp_enabled
  end

  def smtp_enabled
    (Setting[:smtp_enabled].nil?) ? false : Setting[:smtp_enabled]
  end
end

Make smtp_enabled is looked up on each callback
Make smtp_enabled is looked up on each callback

Users will want to turn on and off the SMTP enabled attribute and have
that reflected in real-time without requiring the Rails server to be
rebooted for them to take effect. Previous implementation would only
look at smtp_enabled once for the entire lifetime of the Listener.
