title: cfscript email validation in coldfusion
body: <p>I'm trying to get this bit of code in my cfscript tag to work. I've searched and searched but have some up with nothing which will work to validate the email address.</p>
  
  <p>If the email address is blank it will return the errormessage but if I just type on character, it will let it pass.</p>
  
  <p>I'm pretty new to scripting in CF so any help would be appreciated.</p>
  
  <pre><code>if (isDefined("form.email"))
              {
                  if (form.email is "")
                      {
                          errormessageemail = "Please enter a valid Email Address!";
                      }
                  else if (not form.email is "")
                      {
                          email = form.email;
                          function validate_email(str,email) {
                          if( not len(trim(arguments.str)) or not refind("^[0-9A-Za-z.'+_-]+@([0-9A-Za-z-]+\.)+[A-Za-z]+$", trim(arguments.str)) ) {
                              errormessageemail = "Please enter a valid Email Address! Ex. abc@abc.com";
                              }
                          return errormessageemail;
                          }
                      }
              }
  </code></pre>