Radiant Mailer Extension Installation Basics

I struggled for a while installing this so I thought I’d share the process, in case this helps anyone.

So Radiant is the great content management system for Ruby on Rails. One basic aspect of any web site is a contact form, a web form that mails, or just sending a form via mail. This is “Radiant extension mailer.” It requires “Action Mailer” Plugin from Ruby on Rails. So 3 big steps: install the plugin, the extension, then create the pages.

I configured a few very vanilla Radiant installations on Snow Leopard/sqlite3/radiant 8.1 (ruby 1.8.1, rails 2.3.2 ) to test out this mailer. I’m still checking out the extension, but this is how I got it to work. Success was to get an email from the site, in my inbox, with desired form contents.

BTW, this uses Gmail’s smtp/TLS service- sending mail via your gmail account using their servers.

Install Plugins, etc.

1) First, get the Action Mailer & TLS plugin, by entering this from your Radiant root.

git clone git://github.com/collectiveidea/action_mailer_optional_tls.git vendor/plugins/action_mailer_optional_tls/

Next, modify your environment.rb file in two different places:

2.a) Put this code in the “config.after initialize do” block of your environment.rb file.

ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.raise_delivery_errors = true

ActionMailer::Base.smtp_settings = {
:tls => true,
:address => “smtp.gmail.com”,
:port => 587,
:domain => “yourdomain”,
:authentication => :plain,
:user_name => “yourusername”,
:password => “yourpassword”

Note: the domain is the localhost upon which this application runs. Put in your gmail login and password.

2.b) On line 93 of a vanilla installation, you’ll see:

config.frameworks -= [ :action_mailer ]

This block basically disables it. So we want to enable it! By doing that remove it from the brackets. Now it should look like:

config.frameworks -= [ ]

To test, refresh server. Should refresh with no errors.

3) Next, install Radiant’s Mailer Extension. This will hook-up the form to page parts, and pages, and access the RoR mailer classes. From the Radiant home directory, run:

git clone git://github.com/radiant/radiant-mailer-extension.git vendor/extensions/mailer

You don’t have to run update or migrate (run Rake -T to verify) because the data is all in hashes and not stored in a database.

4) Refresh the server (should be no errors)

Setting Up Mark-Up Pages

Go to the Radiant admin interface create the following:

– Contact page. This will contain the form, using <:mailer ...> tags.
– Page part of contact called “mailer”. This contains the mail settings in YML.
– Page part of contact called “email”. This contains the email content, dynamically rendered.
– A new page, as a results page, for this example it’s called “thanks” This is a regular Radiant page.

I’m going to devote some space to each page, as they were where most of the errors lay.

Contact Page

I kept it simple, with minimal options.
Because this blog is in WordPress and I can’t use code snippets, this is an image. Sorry folks:


Note: the submit is not a :mailer model. For full options for the form, check the readme/github site.

Email Page Part

On the Contact page, add a page part called “email” and include your message.


And enter in the page, the contents of your email. Note, HTML is not supported. (There’s another extension for that- awesome_email, which I doubtlessly will review later!)


Mailer Page Part

This page, on the other hand, very picky. These are the configurations that go to Ruby on Rails’ Action Mailer process. Again, in Contact create a page part called “mailer” (lowercase).


This page part is in YML format, so it is very sensitive in regards to spaces and line endings.


This is a very simple, bare-bones example but it works. This will send to myself, from the person who submitted the form. Note: the redirect-to is *case sensitive*. So make sure the contact and thanks pages are lower case. You will see an error for that issue, if it occurs, in your server log.

OK, with that setup, you can restart your server (just for good luck?) and you’re good to go. Send yourself a message or two.



And the redirect:



  • Make sure all of your Radiant pages are published.
  • Check that there are only 2 spaces before the recipients’ dash, in the mailer page part.
  • Check that your “redirect_to” is in the same case as the actual pages.
  • The form simply “reloads” with no visible progress? If it reloads quickly, it’s probably not actually emailing – as it takes time to hit and verify the Gmail server. Check your server log.
  • If it doesn’t know where to put the result, the redirect path basically, that will be a 302 in your server log.
  • If the form refreshes with the values still in the field, and no “localhost” (or your domain) in the footer, and no mail file in the log, then the configuration of your “mailer” page part is probably wrong- or it could be an issue with your environment.rb edits.
  • If your connection to Gmail works, you will see this kind of printout in your log. If you don’t see this long acknowledgment, then it’s not really sending mail. I’d recommend double-checking your username/password, or reinstalling the action_mailer plugin (just re-git it to that directory, or check the directory to see that it’s installed right). Plugins and extensions have picky naming conventions- the action mailer plugin has to be the name of the file,as well as the “mailer” extension.
    Completed in 132ms (DB: 12) | 200 [http://localhost/contact/]
    -> “220 mx.google.com ESMTP 7sm1568664yxg.68\r\n”
    <- "EHLO banane.com\r\n" -> “250-mx.google.com at your service, []\r\n”
    -> “250-SIZE 35651584\r\n”
    -> “250-8BITMIME\r\n”
    -> “250-STARTTLS\r\n”
    -> “250 PIPELINING\r\n”
    <- "STARTTLS\r\n" -> “220 2.0.0 Ready to start TLS\r\n”
    <- "EHLO banane.com\r\n" -> “250-mx.google.com at your service, []\r\n”
    -> “250-SIZE 35651584\r\n”
    -> “250-8BITMIME\r\n”
    -> “250-AUTH LOGIN PLAIN\r\n”
    -> “250 PIPELINING\r\n”
    <- "AUTH PLAIN AGJhbmFuZQBraXdpa2l3aQ==\r\n" -> “235 2.7.0 Accepted\r\n”
    <- "MAIL FROM:\r\n”
    -> “250 2.1.0 OK 7sm1568664yxg.68\r\n”
    <- "RCPT TO:\r\n”
    -> “250 2.1.5 OK 7sm1568664yxg.68\r\n”
    <- "DATA\r\n" -> “354 Go ahead 7sm1568664yxg.68\r\n”
    writing message from String
    wrote 599 bytes
    -> “250 2.0.0 OK 1256628002 7sm1568664yxg.68\r\n”
    <- "QUIT\r\n" -> “221 2.0.0 closing connection 7sm1568664yxg.68\r\n”

    Further Reading & Notes on What’s Out There


    1. Pingback by banane » Blog Archive » Open Source and Nanowrimo

      Posted on November 14, 2009 at 2:15 pm

      […] know already that the minute I start on this – and I’ve posted a few posts about it (Radiant Mailer Extension Basics, How to Install Radiant Comments, Creating an Extension)- I get in this timeless vacuum and work on […]

    2. Pingback by Adventures in Email Marketing » Ruby on Rails projects |

      Posted on November 15, 2009 at 10:56 pm

      […] rails, namely Action Mailer and the extensions for Radiant, which I’ve written about before. Radiant Mailer Extension Basics Share and […]

    3. Comment by Lamination Montreal

      Posted on November 27, 2009 at 9:34 am

      Hi Banane, I was thinking about using the mail sending back then. How would you rate it?

    4. Comment by nike shox

      Posted on December 30, 2009 at 7:01 pm

      If a jewel falls into the mire, it remains as precious as before; and though dust should ascend to heaven, its former worthlessness will not be altered.

    5. Comment by nike shox

      Posted on December 31, 2009 at 3:01 am

      If a jewel falls into the mire, it remains as precious as before; and though dust should ascend to heaven, its former worthlessness will not be altered.

    6. Comment by Chaitanya Saraf1985

      Posted on June 12, 2010 at 1:45 pm

      Nice One!!! Thats the exactly what i need, Thanks a lot

    7. Comment by zixmail

      Posted on June 18, 2010 at 7:23 am

      i think there are more good tips which is help people!

    8. Comment by danigb

      Posted on November 17, 2010 at 10:48 am

      It didn't work for me until I add :enable_starttls_auto => true into the smtp_settings hash.

    9. Comment by anthonyhsiao

      Posted on July 13, 2013 at 4:15 pm

      Hi – I got it to work but then suddenly it stopped working again, and then at some point it worked for some email recipient address of mine but not for another. I was wondering – do you have any advice on how to debug this more effectively? There seems to be no clear way to identify where in the chain this is breaking…

    10. Comment by anthonyhsiao

      Posted on July 13, 2013 at 5:06 pm

      Ok – I solved my problem – for reference – I was using the heroku sendgrid addon and it adds emails to bounce lists – and I was playing with the contact form with lots of garbage email addresses, so it ultimately added my valid email ad to the bounce list. after clearing it it worked again!

    Leave a comment

    XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>