# Mailer Behaviour Error

**URL:** <https://www.ruby-forum.com/t/mailer-behaviour-error/83463>\
**Category:** Radiant CMS\
**Created:** [January 26, 2007, 11:54am UTC](https://www.ruby-forum.com/t/mailer-behaviour-error/83463 "2007-01-26T11:54:27Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![olicat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/a8b319/32.png) [@olicat](https://www.ruby-forum.com/u/olicat)\
**Post date:** [January 26, 2007, 11:54am UTC](https://www.ruby-forum.com/t/mailer-behaviour-error/83463/1 "2007-01-26T11:54:27Z")

</div>

Hi.

I have just installed the Mailer behaviour for Radiant CMS.

My hosting is with A Small Orange.

When trying to test the form I get the error:

“Error encountered while trying to send email. 550 Administrative  
prohibition”

I have added the config part to the page and also in the environment.rb  
file I added the code shown below (obviously with my own settings):

ActionMailer::Base.server\_settings = {  
:address =\> “[mydomain.com](http://mydomain.com)”,  
:port =\> 25,  
:domain =\> ‘[mydomain.com](http://mydomain.com)’,  
:user\_name =\> “username”,  
:password =\> ‘\*\*\*\*’,  
:authentication =\> :login  
}

Any ideas?

---

<div class="post-metadata">

**Author:** ![olicat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/a8b319/32.png) [@olicat](https://www.ruby-forum.com/u/olicat)\
**Post date:** [January 26, 2007, 11:59am UTC](https://www.ruby-forum.com/t/mailer-behaviour-error/83463/2 "2007-01-26T11:59:47Z")

</div>

Same problem here, I wasn’t able to make it work.

2007/1/26, Oliver C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![olicat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/a8b319/32.png) [@olicat](https://www.ruby-forum.com/u/olicat)\
**Post date:** [January 26, 2007, 3:44pm UTC](https://www.ruby-forum.com/t/mailer-behaviour-error/83463/3 "2007-01-26T15:44:18Z")

</div>

Ok, so I have it working now - it will send an email.

It seemed that the thing it didn’t like was the email address that I  
used in the config part.

I am still having a problem tho - how do I create the body (main text of  
the email) from my form?

I was using an email part of the Contact pag with this in it, but the  
email comes thru empty with a text file attached containing the form  
data…

\<r:mailer:get name=“name”/\> submitted the following:  
mesage = \<r:mailer:get name=“message”/\>

---

<div class="post-metadata">

**Author:** ![olicat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/a8b319/32.png) [@olicat](https://www.ruby-forum.com/u/olicat)\
**Post date:** [January 26, 2007, 3:51pm UTC](https://www.ruby-forum.com/t/mailer-behaviour-error/83463/4 "2007-01-26T15:51:40Z")

</div>

Oliver,

In the mailer extension, I chose to change the way that the email was  
being  
sent from how Matt originally did it in the behavior. For the most part  
and  
in most email clients, it works just fine, and I had used this format in  
a  
previous Rails application that sent email. If someone can find me a  
more  
robust way of creating gracefully degrading emails, I’d be delighted to  
change it.

Sean

---

<div class="post-metadata">

**Author:** ![olicat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/a8b319/32.png) [@olicat](https://www.ruby-forum.com/u/olicat)\
**Post date:** [January 26, 2007, 4:01pm UTC](https://www.ruby-forum.com/t/mailer-behaviour-error/83463/5 "2007-01-26T16:01:36Z")

</div>

Sorry Sean, what do you mean by your post exactly? Is that just the way  
it is, that it will come thru as a text file?

I am using Hotmail to view the email - will that have any effect?

Sean C. wrote:

> Oliver,
> 
> In the mailer extension, I chose to change the way that the email was  
> being  
> sent from how Matt originally did it in the behavior. For the most part  
> and  
> in most email clients, it works just fine, and I had used this format in  
> a  
> previous Rails application that sent email. If someone can find me a  
> more  
> robust way of creating gracefully degrading emails, I’d be delighted to  
> change it.
> 
> Sean

---

<div class="post-metadata">

**Author:** ![olicat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/a8b319/32.png) [@olicat](https://www.ruby-forum.com/u/olicat)\
**Post date:** [January 26, 2007, 4:10pm UTC](https://www.ruby-forum.com/t/mailer-behaviour-error/83463/6 "2007-01-26T16:10:42Z")

</div>

Oh, I see what you mean. Use the subject: line in your ‘config’ part,  
just  
as you do for the from, recipients, etc.

Sean

---

<div class="post-metadata">

**Author:** ![olicat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/a8b319/32.png) [@olicat](https://www.ruby-forum.com/u/olicat)\
**Post date:** [January 26, 2007, 4:14pm UTC](https://www.ruby-forum.com/t/mailer-behaviour-error/83463/7 "2007-01-26T16:14:50Z")

</div>

My config part is at follows:

mailers:  
contact:  
subject: Contact Form  
from: \*\*\*@\*\*\*.com  
redirect\_to: /contact/thank-you/  
recipients:  
- \*\*\*@\*\*\*.com

But it doesn’t seem to make any difference to the subject line?

Sean C. wrote:

> Oh, I see what you mean. Use the subject: line in your ‘config’ part,  
> just  
> as you do for the from, recipients, etc.
> 
> Sean

---

<div class="post-metadata">

**Author:** ![olicat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/a8b319/32.png) [@olicat](https://www.ruby-forum.com/u/olicat)\
**Post date:** [January 26, 2007, 4:05pm UTC](https://www.ruby-forum.com/t/mailer-behaviour-error/83463/8 "2007-01-26T16:05:50Z")

</div>

I opened the email using Thunderbird and it apearred fine.

However, the subject of the email comes thru as:

“Form Mail from [www.aromatherapymassageyeovil.co.uk](http://www.aromatherapymassageyeovil.co.uk)”

Am I able to change this somehow?

Oliver C. wrote:

> Sorry Sean, what do you mean by your post exactly? Is that just the way  
> it is, that it will come thru as a text file?
> 
> I am using Hotmail to view the email - will that have any effect?
> 
> Sean C. wrote:
> 
> > Oliver,
> > 
> > In the mailer extension, I chose to change the way that the email was  
> > being  
> > sent from how Matt originally did it in the behavior. For the most part  
> > and  
> > in most email clients, it works just fine, and I had used this format in  
> > a  
> > previous Rails application that sent email. If someone can find me a  
> > more  
> > robust way of creating gracefully degrading emails, I’d be delighted to  
> > change it.
> > 
> > Sean

---

<div class="post-metadata">

**Author:** ![olicat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/a8b319/32.png) [@olicat](https://www.ruby-forum.com/u/olicat)\
**Post date:** [January 26, 2007, 4:20pm UTC](https://www.ruby-forum.com/t/mailer-behaviour-error/83463/9 "2007-01-26T16:20:47Z")

</div>

Oh, I’m sorry. You’re using the mailer behavior and not the extension.  
My  
bad. I had that problem too, so I fixed it in the behavior.

Sean

---

<div class="post-metadata">

**Author:** ![olicat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/a8b319/32.png) [@olicat](https://www.ruby-forum.com/u/olicat)\
**Post date:** [January 26, 2007, 4:23pm UTC](https://www.ruby-forum.com/t/mailer-behaviour-error/83463/10 "2007-01-26T16:23:53Z")

</div>

How is the best way to fix this then?

Cribbs wrote:

> Oh, I’m sorry. You’re using the mailer behavior and not the extension.  
> My  
> bad. I had that problem too, so I fixed it in the behavior.
> 
> Sean

---

<div class="post-metadata">

**Author:** ![olicat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/a8b319/32.png) [@olicat](https://www.ruby-forum.com/u/olicat)\
**Post date:** [January 26, 2007, 4:30pm UTC](https://www.ruby-forum.com/t/mailer-behaviour-error/83463/11 "2007-01-26T16:30:04Z")

</div>

I mean it’s not really a major problem as such in the grand schemes of  
things, but would be good to know how to change the email subject…

Oliver C. wrote:

> How is the best way to fix this then?
> 
> Cribbs wrote:
> 
> > Oh, I’m sorry. You’re using the mailer behavior and not the extension.  
> > My  
> > bad. I had that problem too, so I fixed it in the behavior.
> > 
> > Sean

---

<div class="post-metadata">

**Author:** ![olicat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/a8b319/32.png) [@olicat](https://www.ruby-forum.com/u/olicat)\
**Post date:** [January 26, 2007, 5:03pm UTC](https://www.ruby-forum.com/t/mailer-behaviour-error/83463/12 "2007-01-26T17:03:54Z")

</div>

try putting this in between your \<r:mailer:form\> tags…

\<r:mailer:hidden name=“subject” value=“Your subject here!” /\>

works for me, not sure why it doesnt the other way…

---

<div class="post-metadata">

**Author:** ![olicat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/a8b319/32.png) [@olicat](https://www.ruby-forum.com/u/olicat)\
**Post date:** [January 26, 2007, 4:19pm UTC](https://www.ruby-forum.com/t/mailer-behaviour-error/83463/13 "2007-01-26T16:19:46Z")

</div>

Is this in development mode? Rails might be caching your yml file if  
you’re working on production mode.

---

<div class="post-metadata">

**Author:** ![olicat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/a8b319/32.png) [@olicat](https://www.ruby-forum.com/u/olicat)\
**Post date:** [January 26, 2007, 5:57pm UTC](https://www.ruby-forum.com/t/mailer-behaviour-error/83463/14 "2007-01-26T17:57:05Z")

</div>

=] no worries…

i cant remember if i found that in a how-to somewhere, or if i figured  
that one from the code itself…

---

<div class="post-metadata">

**Author:** ![olicat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/a8b319/32.png) [@olicat](https://www.ruby-forum.com/u/olicat)\
**Post date:** [January 28, 2007, 12:36am UTC](https://www.ruby-forum.com/t/mailer-behaviour-error/83463/15 "2007-01-28T00:36:54Z")

</div>

Oliver,  
Can you post your config part and whats in your environment.rb file.  
I can’t for the life of me get the mailer behavior/extension to work  
on ASmallOrange.  
Specifically, what username and server are you using?  
Thanks,  
BJ Clark

---

<div class="post-metadata">

**Author:** ![olicat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/a8b319/32.png) [@olicat](https://www.ruby-forum.com/u/olicat)\
**Post date:** [January 26, 2007, 5:07pm UTC](https://www.ruby-forum.com/t/mailer-behaviour-error/83463/16 "2007-01-26T17:07:48Z")

</div>

Michael - you’re a star!

It worked a treat adding in that line of code.

I tried it before but think I just had it in the wrong place!!!

Thanks.

Michael R. wrote:

> try putting this in between your \<r:mailer:form\> tags…
> 
> \<r:mailer:hidden name=“subject” value=“Your subject here!” /\>
> 
> works for me, not sure why it doesnt the other way…

---

<div class="post-metadata">

**Author:** ![olicat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/a8b319/32.png) [@olicat](https://www.ruby-forum.com/u/olicat)\
**Post date:** [January 29, 2007, 10:27am UTC](https://www.ruby-forum.com/t/mailer-behaviour-error/83463/17 "2007-01-29T10:27:57Z")

</div>

My environment.tb file has these lines at the VERY bottom of it, with  
nothing coming after the closed bracket:

ActionMailer::Base.server\_settings = {  
:address =\> “[aromatherapymassageyeovil.co.uk](http://aromatherapymassageyeovil.co.uk)”,  
:port =\> 25,  
:domain =\> ‘[aromatherapymassageyeovil.co.uk](http://aromatherapymassageyeovil.co.uk)’,  
:user\_name =\> “username”,  
:password =\> ‘password’,  
:authentication =\> :login  
}

Obviously replace the username and password with the ones that you chose  
when you set up your hosting account with A Small Orange. Also,  
obviously, change the domains to your one.

Next, on my Radiant admin page I have a page called contact (a child  
from the home page). Its behaviour (set at the bottom) is set to Mailer.  
In this page I have the following:

\<r:mailer:form name=“contact”\>  
\<r:mailer:hidden name=“subject” value=“Floral Magic Enquiry” /\>  
Name:  
  
\<r:mailer:text name=“name” /\>   
  
Message:  
  
\<r:mailer:textarea name=“message” /\>   
  
\<r:mailer:submit value=“Send” /\>  
\</r:mailer:form\>

I created a new part for this page (by clicking the green plus icon on  
the right) and named it config. In this part I have:

mailers:  
contact:  
subject: Contact Form  
from: removed\_email\_address@domain.invalid  
redirect\_to: /contact/thank-you/  
recipients:  
- removed\_email\_address@domain.invalid

Make sure that the indents look exactly the same, and that you replace  
the two email addresses with your own, and ones that ACTUALLY work. I  
made this mistake and used one I hadn’t actually set up yet. You can  
evne use a hotmail address if you want.

Create another part for this page in the same way. Call it email. In  
this part I have the following:

\*\*\* FLORAL MAGIC ENQUIRY \*\*\*

Name: \<r:mailer:get name=“name”/\>

Message: \<r:mailer:get name=“message”/\>

Sent: \<r:date /\>

This basically formats the email that is sent with the form data. Next,  
create a new page called thank-you that is a child of the Contact page.  
Just put some simple text in this page.

All being well this should work!!!
