Using the Mailer Behaviour for Radiant on Textdrive

Hi Everyone,

I was having a problem getting the very cool Mailer Behavior to work
on Radiant CMS installation on my Textdrive shared hosting account. I
talked to John and he was very kind to help me get this working. So I
am going to repay that kindness and send directions of how to
accomplish at the request of John to the mailing list. So here it goes:

  1. Install Radiant. (Do a search on how to do this for TextDrive.
    There are very good instructions on how to do this)

  2. Using a terminal app, go to the Radiant root address. Something
    like: domains/domain-name.com/web/radiant

  3. Now you will want to install the behavior. Type in the terminal:
    script/plugin install http://mattmccray.com/svn/rails/plugins/
    radiant_mailer_behavior/

  4. After the install is done you need to insert the behavior into the
    environment.rb by typing this in the terminal: sed -i ‘’
    ‘s/, :action_mailer//’ config/environment.rb

  5. Now go to your favorite ftp program and locate your
    environment.rb, which will be located in the config directory in the
    root of your radiant install. Edit the environment.rb file and add
    this to the bottom of it (select what is between the #'s):

#########

ActionMailer::Base.server_settings = {
:address => “mydomain.com”,
:port => 25,
:domain => ‘mydomain.com’,
:user_name => “username”,
:password => ‘****’,
:authentication => :login
}

#########

Change “mydomain”, “username”, and “****” to reflect your server
settings. Keep the quotes. The mydomain.com would be the domain you
installed Radiant on and the username and password are your Textdrive
settings.

Save the environment.rb file.

  1. Now since you edited the environment.rb file you will need to
    restart your rails app(which of course is Radiant)

  2. Open your browser and point it to your site’s Radiant login. (ie:
    mydomain.com/admin) and then login

  3. Create a page named: Contact. Once you are in the Contact page,
    create a part and name it config. Add this in the config part (select
    what is between the #'s):

##########

mailers:
contact:
subject: From Contact Form
from: [email protected]
redirect_to: /contact/thank-you/
recipients:
- [email protected]

##########

Change [email protected] to your email address.

  1. Now click on the body tab while you are still in the Contact page
    and add this code to it (select what is between the #'s):

##########

<r:mailer:form name=“contact”>
<r:mailer:hidden name=“subject” value=“Email from my Radiant
site!” />

Name:

<r:mailer:text name=“name” />

Message:

<r:mailer:textarea name=“message” />

<r:mailer:submit value=“Send” />
</r:mailer:form>

###########

Select “Mailer” from the behavior list. Click “Create Page”

  1. Now add a child page to Contact and name it “thank-you”. This
    will be the page your mailer form will redirect when it is submitted.
    NOTE: you can name it whatever you want. Just make sure you update it
    in the config part of the Contact page.

  2. And that should do it! Point your browser to the Contact page and
    test your form.

I hope everything works for you and that I explained it to the point
it was easy and understandable. I’m not a programmer so I am not 100%
sure of what some of this coding even means except for the obvious.
So I won’t be much help for trouble-shooting. If you do have trouble
though, ask around the forums. There are many people out there
willing to help.

Peter,

That’s a wonderful How-To! Could you add it to the Wiki
(http://dev.radiantcms.org/radiant/wiki/HowTos)?

Sean C.
seancribbs.com