# Adding an e-mail form

**URL:** <https://www.ruby-forum.com/t/adding-an-e-mail-form/99965>\
**Category:** Radiant CMS\
**Created:** [July 26, 2006, 12:31pm UTC](https://www.ruby-forum.com/t/adding-an-e-mail-form/99965 "2006-07-26T12:31:50Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![japj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@japj](https://www.ruby-forum.com/u/japj)\
**Post date:** [July 26, 2006, 12:31pm UTC](https://www.ruby-forum.com/t/adding-an-e-mail-form/99965/1 "2006-07-26T12:31:50Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![japj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@japj](https://www.ruby-forum.com/u/japj)\
**Post date:** [July 26, 2006, 3:15pm UTC](https://www.ruby-forum.com/t/adding-an-e-mail-form/99965/2 "2006-07-26T15:15:46Z")

</div>

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](http://scottwalter.com/blog)  
Pro:Blog - [http://scottwalter.com/problog](http://scottwalter.com/problog)  
Snippets - [http://snippets.scottwalter.com](http://snippets.scottwalter.com)

----- Original Message ----  
From: Jeroen J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: removed\_email\_address@domain.invalid  
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

---

<div class="post-metadata">

**Author:** ![japj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@japj](https://www.ruby-forum.com/u/japj)\
**Post date:** [July 26, 2006, 3:40pm UTC](https://www.ruby-forum.com/t/adding-an-e-mail-form/99965/3 "2006-07-26T15:40:33Z")

</div>

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

* * *

---

<div class="post-metadata">

**Author:** ![japj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@japj](https://www.ruby-forum.com/u/japj)\
**Post date:** [July 26, 2006, 4:14pm UTC](https://www.ruby-forum.com/t/adding-an-e-mail-form/99965/4 "2006-07-26T16:14:58Z")

</div>

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](http://scottwalter.com/blog)  
Pro:Blog - [http://scottwalter.com/problog](http://scottwalter.com/problog)  
Snippets - [http://snippets.scottwalter.com](http://snippets.scottwalter.com)

----- Original Message ----  
From: Jeroen J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: removed\_email\_address@domain.invalid  
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

* * *

## removed\_email\_address@domain.invalid | www.laika.nl | +31(0)20 612 76 45 Pazzanistraat 17 | 1014 DB | Amsterdam | The Netherlands

---

<div class="post-metadata">

**Author:** ![japj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@japj](https://www.ruby-forum.com/u/japj)\
**Post date:** [July 27, 2006, 2:36pm UTC](https://www.ruby-forum.com/t/adding-an-e-mail-form/99965/5 "2006-07-27T14:36:12Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![japj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@japj](https://www.ruby-forum.com/u/japj)\
**Post date:** [July 31, 2006, 1:55pm UTC](https://www.ruby-forum.com/t/adding-an-e-mail-form/99965/6 "2006-07-31T13:55:51Z")

</div>

On Jul 31, 2006, at 2:52 AM, M@ 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

* * *

---

<div class="post-metadata">

**Author:** ![japj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@japj](https://www.ruby-forum.com/u/japj)\
**Post date:** [July 31, 2006, 2:54am UTC](https://www.ruby-forum.com/t/adding-an-e-mail-form/99965/7 "2006-07-31T02:54:36Z")

</div>

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](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,  
M@ McCray

---

<div class="post-metadata">

**Author:** ![japj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@japj](https://www.ruby-forum.com/u/japj)\
**Post date:** [July 31, 2006, 2:36pm UTC](https://www.ruby-forum.com/t/adding-an-e-mail-form/99965/8 "2006-07-31T14:36:59Z")

</div>

> 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

* * *
