# Is there any kind of validation in the mailer extension?

**URL:** <https://www.ruby-forum.com/t/is-there-any-kind-of-validation-in-the-mailer-extension/153360>\
**Category:** Radiant CMS\
**Created:** [November 15, 2008, 5:26pm UTC](https://www.ruby-forum.com/t/is-there-any-kind-of-validation-in-the-mailer-extension/153360 "2008-11-15T17:26:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nateless](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/96bed5/32.png) [@nateless](https://www.ruby-forum.com/u/nateless)\
**Post date:** [November 15, 2008, 5:26pm UTC](https://www.ruby-forum.com/t/is-there-any-kind-of-validation-in-the-mailer-extension/153360/1 "2008-11-15T17:26:25Z")

</div>

I am using the mailer extension for the first time and was wondering if  
there is any kind of form validation built into the extension. I looked  
at  
the code and I cannot find anything. Did I miss something? How are other  
people doing form validation with mailer?

Thanks,

Nate

---

<div class="post-metadata">

**Author:** ![nateless](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/96bed5/32.png) [@nateless](https://www.ruby-forum.com/u/nateless)\
**Post date:** [November 16, 2008, 9:20am UTC](https://www.ruby-forum.com/t/is-there-any-kind-of-validation-in-the-mailer-extension/153360/2 "2008-11-16T09:20:14Z")

</div>

Hi Nate,

The mailer extension supports very simple validation. It enforces  
mandatory fields, and ensures the “from” and “recipients” fields  
exists and have an @ in the email address. The from and recipients  
enforcement comes right out of the box. Nothing to do to get that  
working.

To make a mandatory field, you add a required attribute

\<r:mailer:textarea name=“message” required=“true” /\>

When that field fails validation (no content is provided) you can get  
at the error messages with the mailer errors tags.

\<r:mailer:error on=“message” \>

Message \<r:mailer:error:message /\>

  
\</r:mailer:error\>

the error message is “is required”.

The error messages the from and recipients fields are stored against  
the “form”. To access those…

\<r:mailer:error on=“form” \>

\<r:mailer:error:message /\>

  
\</r:mailer:error\>

Hope that helps.

Thanks,

::: hamish rickerby :::  
m: removed\_email\_address@domain.invalid

[http://glimmerdesign.com](http://glimmerdesign.com)
