[Radiant] Using the Mailer Behaviour for Radiant on Textdrive

Peter Burgess peteburgess at gmail.com
Tue Dec 5 21:52:27 CST 2006


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.

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

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

8. 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: noreply at yourdomain.com
     redirect_to: /contact/thank-you/
     recipients:
       - test at yourdomain.com

##########

Change test at yourdomain.com to your email address.

9. 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!" /> <br />
  Name:<br/>
    <r:mailer:text name="name" /> <br />
  Message:<br />
    <r:mailer:textarea name="message" /> <br />
  <r:mailer:submit value="Send" />
</r:mailer:form>

###########


Select "Mailer" from the behavior list. Click "Create Page"

10. 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.

11. 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.





More information about the Radiant mailing list