ContactForm

This gem contains a little contact form. It is build with a mountable engine. It is simple and just sends two emails. Nothing gets saved to the database. The first email is to the website administrator and the second email is an auto reply to the user.

Quick Start

gem install contact_form

Or add it to your Gemfile:

gem "contact_form"

Run the generator to generate an initializer file, a config yml file and locale files

rails g contact_form:install

You can easily customize all files. The generated file under “/config” contains the mailer recipients, you can change them the way you want. The generated files under “/config/locales” contains i18n keys which can also be changed.

After you run the generator you can mount the engine in your routes.rb

mount ContactForm::Engine => "/contact_form", :as => :contact_form

Visit

http://localhost:3000/contact_form

and you’ll see the result! You can override this route in your route file.

Generators

There are following generators available for customizing your contact form:

rails g contact_form:views          # generates view files
rails g contact_form:models         # generates model files
rails g contact_form:controllers    # generates controller files
rails g contact_form:mailers        # generates mailer files

Or simple generate all files

rails g contact_form:all            # generates all files

Copyright © 2012 Matthias Frick, released under the MIT license