Adding an e-mail form

I have to add a simple contact e-mail form to a Radiant based
website. Unfortunately the mailer behaviour doesn’t seem to work
anymore with the latest version of Radiant.

Because I don’t have the time (or skill level) to fix mailer
behaviour or make a proper behaviour myself I’m trying to make my own
form in Rails and add a custom route to this page. Sounds simple
enoguh, but I’m stuck at the route part.

Something like this should work, right? Or am I missing something?

map.connect ‘contact’, :controller => “info_mailer”, :action =>
‘show’

I just get a regular Radiant page not find error, so I guess I’m
doing something wrong.

Can someone point me in the right direction, or, even better has
anyone implemented a simple contact e-mail form or does anyone know
how to fix mailer behaviour?

Where are you putting the route? Is it at the end? If so you’re
getting tripped up by:

Site URLs

map.with_options(:controller => ‘site’) do |site|
site.homepage ‘’, :action
=> ‘show_page’, :url => ‘/’
site.not_found ‘error/404’, :action
=> ‘not_found’
site.error ‘error/500’, :action
=> ‘error’

# Everything else
site.connect           '*url',                               :action 

=> ‘show_page’
end

This Radiant route pretty much handles everything. If you notice in
routes.rb all the admin routes are above this one. Try putting your
route above it to see what happens.

cheers,

scott


What’s an Intel chip doing in a Mac? A whole lor more that it’s ever
done in a PC.

My Digital Life - http://scottwalter.com/blog
Pro:Blog - http://scottwalter.com/problog
Snippets - http://snippets.scottwalter.com

----- Original Message ----
From: Jeroen J. [email protected]
To: [email protected]
Sent: Wednesday, July 26, 2006 5:29:47 AM
Subject: [Radiant] Adding an e-mail form

I have to add a simple contact e-mail form to a Radiant based website.
Unfortunately the mailer behaviour doesn’t seem to work anymore with the
latest version of Radiant.

Because I don’t have the time (or skill level) to fix mailer behaviour
or make a proper behaviour myself I’m trying to make my own form in
Rails and add a custom route to this page. Sounds simple enoguh, but I’m
stuck at the route part.

Something like this should work, right? Or am I missing something?

map.connect ‘contact’, :controller => “info_mailer”, :action => ‘show’

I just get a regular Radiant page not find error, so I guess I’m doing
something wrong.

Can someone point me in the right direction, or, even better has anyone
implemented a simple contact e-mail form or does anyone know how to fix
mailer behaviour?


Jeroen

On Jul 26, 2006, at 3:14 PM, Scott W. wrote:

Where are you putting the route? Is it at the end? If so you’re
getting tripped up by:

It the very first route…


Jeroen J.
Laika online entertainment


You’re right it doesn’t work! I’m not a routes guru, but I got it to
work with this:

map.with_options(:controller => ‘info_mailer’) do |contact|
contact.show ‘contact/show’, :action => ‘show’
end

Then I had to edit the info_mailer controller to disable authentication
check as well as set the layout otherwise you will get the Radiant admin
layout:

class InfoMailerController < ApplicationController
no_login_required
layout “mylayout”

def show
end
end

Then I can go to localhost:3000/contact/show

scott.


What’s an Intel chip doing in a Mac? A whole lor more that it’s ever
done in a PC.

My Digital Life - http://scottwalter.com/blog
Pro:Blog - http://scottwalter.com/problog
Snippets - http://snippets.scottwalter.com

----- Original Message ----
From: Jeroen J. [email protected]
To: [email protected]
Sent: Wednesday, July 26, 2006 8:38:56 AM
Subject: Re: [Radiant] Adding an e-mail form

On Jul 26, 2006, at 3:14 PM, Scott W. wrote:
Where are you putting the route? Is it at the end? If so you’re
getting tripped up by:

It the very first route…


Jeroen J.
Laika online entertainment


[email protected] | www.laika.nl | +31(0)20 612 76 45
Pazzanistraat 17 | 1014 DB | Amsterdam | The Netherlands

Could I dare to call the community to help many current and potential
Radiant users by fixing both the mailer and the password protection
plug-in? For an end user it is very important that besides the core
functionalities there are others available that enrich the product.
Thank you!

On Jul 31, 2006, at 2:52 AM, [email protected] McCray wrote:

unless
you modified the environment.rb to stop excluding action_mailer… I’m
not sure why Radiant does that anyway.

Tnaks for the answer, Matt.

I used to get an error ‘protected method `get_class_name’ called for
#’ but I’ve done a fresh install of Radiant and the behavior and it
seems to be working now.

I still get an error ‘Error encountered while trying to send email.
Connection refused - connect(2)’ but I think that I haven’t
configured it properly. Some things are not completely clear to me to
be honest… where exactly do I configure which e-mail server will be
used? In the ‘config’ page part and if so, how?


Jeroen J.
Laika online entertainment


Jeroen J. wrote:

Unfortunately the mailer behaviour doesn’t seem to work anymore with
the latest version of Radiant.
Can someone point me in the right direction, or, even better has
anyone implemented a simple contact e-mail form or does anyone know
how to fix mailer behaviour?

What is the problem with it? It seems to be working with Radiant 0.5 for
me. Well, mostly. I did notice that it wouldn’t always send mail unless
you modified the environment.rb to stop excluding action_mailer… I’m
not sure why Radiant does that anyway.

I went ahead and checked in a fix that manually requires
‘action_mailer’… So it should send mail correctly. The latest version
is 0.2.1
(http://mattmccray.com/svn/rails/plugins/radiant_mailer_behavior)

If there are problems, please send me a bug report ( darthapo at gmail
dot com ) – Please include the stacktrace, what version (or revision)
of Radiant you are using, plus any plugins you have installed that could
effect the behavior.

Thanks,
[email protected] McCray

I used to get an error ‘protected method `get_class_name’ called
for #’ but I’ve done a fresh install of Radiant and the behavior
and it seems to be working now.
I still get an error ‘Error encountered while trying to send email.
Connection refused - connect(2)’

Let me clarify that, it seems to be working on my local machine when
I try the same code on my Dreamhost site it unfortunately still gives
a ‘protected method `get_class_name’ called for #’ error.


Jeroen J.
Laika online entertainment


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs