lenawu/mak-169

View on GitHub
app/models/contact.rb

Summary

Maintainability
A
0 mins
Test Coverage
class Contact < MailForm::Base
  attribute :name,      :validate => true
  attribute :email,     :validate => /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i
  attribute :message
  attribute :nickname,  :captcha  => true

  # Declare the e-mail headers. It accepts anything the mail method
  # in ActionMailer accepts.
  def headers
    {
      :subject => "My Contact Form",
      :to => "ankita@makelabs.org",
      :from => %("#{name}" <#{email}>)
    }
  end
end