= Description

A rack end point for a contact form. Will put all the params in an
e-mail sent to a pre-configured address.

= Features

* Build on the mail gem allowing us to take advantage of well tested e-mail
  construction and build on it's excellent API.
* Will send any data posted via a web form to the configured address
* Reasonble defaults for everything except where the mail should be sent to
  allowing quick implementation.
* Ability to configure auto-responder to poster
* Basic spam protection

Why use this over ActionMailer or the mail gem itself?

* ActionMailer is often overkill for what is often an e-mail to an person
  internal to an organization that just needs the info without fancy formatting.
* The mail gem is obviously the core of this rack module. But this allows for
  you to get the form up and running much quicker as it has minimal
  configuration and it can actually process multiple different forms.

= Usage

== Rack

  Rack::Builder.app do
    map '/mail_to' do
      run Rack::Mailer.new {to 'joe@example.com'}
    end
  end

== Rails

  match '/mail_to' => Rack::Mailer.new {to 'joe@example.com'}

Will send any forms posted to /mail_to to joe@example.com.

== Configuration

There are also a variety of other config options:

  match '/mail_to' => Rack::Mailer.new {

    # E-mail notification properties
    to 'joe@example.com'
    from 'no-reply@example.com'
    subject 'This just in!'
    body 'Some info submitted:'

    # What to do when done
    success_url '/success'
    failure_url '/failure'

    # Message to automatically send to user that filled out form.
    auto_responder do |params|
      to params['email']
      from 'no-reply@example.com'
      subject 'Your message was received'
      body 'Your message was received. We may or may not get back to you :)'
    end

    # Spam protection. Should not be filled out by end user and will be
    # removed from the e-mail.
    spam_field 'email2'

    # Will ignore a field name ignore. Default to ignoring some
    # auto-generated Rails fields.
    field_filter << 'ignore'
  }

= Todo

Features to add:

* Support nested params (i.e. activities[outdoor][], etc.)
* Add the ability to specify required fields and/or other validation so
  we don't have to rely on JavaScript validation.
