Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Save fields from mailer forms to the database.
Pull request Compare This branch is even with church-initiative:master.
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Database Mailer


A Radiant Extension by Aissac that adds database persistence to emailed forms. It works on top of the Radiant Mailer Extension and the fields recorded to the database are user defined. The extension adds a tab to the Radiant admin interface allowing you to browse saved records.

Tested on Radiant 0.7.1, 0.8 and 0.9 RC1.

Check out the screencast


  • Save posted form fields and entire mail message to the database
  • Save e-mail attachments using paperclip
  • Configurable save-to-database for mailer forms
  • Add fields to be saved without loosing data
  • Admin interface to browse saved records
  • Export data to CSV and XLS

Important Notice!

The git branches on this repository hold stable versions of the extension for older versions of Radiant CMS. For example the 0.8 branch is compatible with Radiant 0.8.

To checkout one of these branches:

git clone git:// vendor/extensions/database_mailer
cd vendor/extensions/database_mailer
git checkout -b <branch-name> origin/<remote-branch-name>

As an example if you're working on Radiant 0.8 you will need to checkout the 0.8 branch:

cd vendor/extensions/database_mailer
git checkout -b my_branch origin/0.8


Radiant Database Mailer Extension has three dependecies, the Radiant Mailer Extension, the will_paginate gem/plugin and the paperclip gem/plugin

Install the mailer extension:

git clone git:// vendor/extensions/mailer


At the time being you will need Aissac's version of the Radiant Mailer Extension, as it incorporates sending e-mails with attachments.

the will_paginate gem/plugin:

git clone git:// vendor/plugins/will_paginate


sudo gem install will_paginate

and the paperclip gem/plugin

git clone git:// vendor/plugins/paperclip


sudo gem install paperclip

Next edit config/environment.rb and add desired fields to be recorded:

  :name => :string,
  :message => :text,
  :email => :string

And finally add the Database Mailer Extension:

git clone git:// vendor/extensions/database_mailer

Migrate and update the extension:

rake radiant:extensions:database_mailer:migrate
rake radiant:extensions:database_mailer:update


Adding fields to the DATABASE_MAILER_COLUMNS hash and re-running rake radiant:extensions:database_mailer:migrate nondestructively adds fields to be saved. Fields removed from the hash are not deleted.

Look at the Mailer Extension README for information on how to configure mail delivery.

If you set save_to_database to false in the Mailer config, saving to the database is skipped and just mail delivery takes place. Example (in the mailer page part):

subject: From the website of Whatever
redirect_to: /contact/thank-you
save_to_database: false

Any attachments that the e-mail might have will be saved on the file system. They can be downloaded from the details page of every record.

If you want to take advantage of the blob field you need to create a email page part. The blob field keeps the sent version of the email.

Fields that are not specified by DATABASE_MAILER_COLUMNS are silently ignored.


Create your Mailer pages and make sure to use the same field names:

  <label for="name">Name:</label><br/>
  <r:mailer:text name="name" /><br/>

  <label for="email">Email:</label><br/>
  <r:mailer:text name="email" /><br/>

  <label for="message">Message:</label><br/>
  <r:mailer:textarea name="message" /> <br/>

  <label for="attachment">Image:</label><br/>
  <r:mailer:file name="attachment" /><br/>

  <input type="submit" value="Send" />

Create the mailer page part:

subject: From the website of Whatever
redirect_to: /contact/thank-you

Create an email page part (to take advantage of the blob field):

  Name: <r:get name="name" />
  Email: <r:get name="email" />
  Message: <r:get name="message" />


Something went wrong with that request. Please try again.