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:
-
Install Radiant. (Do a search on how to do this for TextDrive.
There are very good instructions on how to do this) -
Using a terminal app, go to the Radiant root address. Something
like: domains/domain-name.com/web/radiant -
Now you will want to install the behavior. Type in the terminal:
script/plugin install http://mattmccray.com/svn/rails/plugins/
radiant_mailer_behavior/ -
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 -
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.
-
Now since you edited the environment.rb file you will need to
restart your rails app(which of course is Radiant) -
Open your browser and point it to your site’s Radiant login. (ie:
mydomain.com/admin) and then login -
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.
- 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”
-
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. -
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.