Sha256: 07f7e2128cdd54f5e48b07ff17cdaee065d1fa46e20c31857c60a0fcaa72e600

Contents?: true

Size: 1.31 KB

Versions: 16

Compression:

Stored size: 1.31 KB

Contents

# Generic contact form class.  If changes are needed, then a new version should
# be created in the theme's models folder
#------------------------------------------------------------------------------
class ContactForm < ::MailForm::Base
  
  attribute :name,        :validate => true
  attribute :email,       :validate =>  /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i
  attribute :organization                    # Not validated
  attribute :subject,     :validate => true
  attribute :message,     :validate => true
  attribute :reason,      :validate => true
  attribute :nickname,    :captcha  => true
  
  # append    :remote_ip, :user_agent, :session   # append these values to the end of all emails

  # for a contact form, the "from" address should be a valid email address
  # within the domain that is doing the actual sending, instead of the contacter's
  # address.  This important for services like Sparkpost or Mandrill, that checks
  # the validity of the sending domain.
  #------------------------------------------------------------------------------
  def headers
    { subject:  "#{I18n.t('cms.contact_form.subject_prefix')}: #{reason}: #{subject}" , 
      to:       Account.current.preferred_support_email,
      from:     Account.current.preferred_support_email,
      reply_to: %("#{name}" <#{email}>)
    }
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
dm_cms-4.2.3.10 app/models/contact_form.rb
dm_cms-4.2.3.9 app/models/contact_form.rb
dm_cms-4.2.3.8 app/models/contact_form.rb
dm_cms-4.2.3.7 app/models/contact_form.rb
dm_cms-4.2.3.6 app/models/contact_form.rb
dm_cms-4.2.3.5 app/models/contact_form.rb
dm_cms-4.2.3.4 app/models/contact_form.rb
dm_cms-4.2.3.3 app/models/contact_form.rb
dm_cms-4.2.3.2 app/models/contact_form.rb
dm_cms-4.2.3.1 app/models/contact_form.rb
dm_cms-4.2.3 app/models/contact_form.rb
dm_cms-4.2.2.3 app/models/contact_form.rb
dm_cms-4.2.2.2 app/models/contact_form.rb
dm_cms-4.2.2.1 app/models/contact_form.rb
dm_cms-4.2.2 app/models/contact_form.rb
dm_cms-4.2.1.5 app/models/contact_form.rb