Hi Rick

On cflib.org there is a function titled 'isEmail' I have used this a few
times to validate emails. The function code is a s follows:


<cfscript>
function isEmail(str) {
    return (REFindNoCase("^['_a-z0-9-]+(\.['_a-z0-9-]+)[EMAIL 
PROTECTED](\.[a-z0-9-]+)*\.(([a-z]{2,3})|(aero|coop|info|museum|name|jobs|travel))$",arguments.str)
AND len(listGetAt(arguments.str, 1, "@")) LTE 64 AND
len(listGetAt(arguments.str, 2, "@")) LTE 255) IS 1;
}</cfscript>

Another alternative if you are using sql server is to doa  sql
function and wrap the email element in that for validation.

Hope this helps

Jose Diaz




On 4/14/06, Denny Valliant <[EMAIL PROTECTED]> wrote:
>
> A crazy option would be to use a regular expression (available in MySQL)
> to
> grab only valid emails.
>
> Heh. With the regex stuff going  on, had to mention it.
>
> By the by, a useful resource for regex for me has been
> www.regular-expressions.com.
> :D3|\|*
>
> On 4/13/06, Dawson, Michael <[EMAIL PROTECTED]> wrote:
> >
> > I think you are totally correct.  You will need to do the CFLOOP thing
> > to be able to catch an individual CFMAIL exception.
> >
> > M!ke
> >
> > -----Original Message-----
> > From: Rick Root [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, April 13, 2006 9:07 PM
> > To: CF-Talk
> > Subject: catching a query based cfmail ...
> >
> > If I'm using cfmail with the query attribute, populating the to address
> > dynamically... how to I catch an individual exception?
> >
> > Like if one row in the query contains an invalid email address that
> > throws a cfmail exception.
> >
> > If i put try/catch around the whole cfmail tag set it'll actually stop
> > the whole mailing...
> >
> > I'm assuming there's no way to do what I want to do without axing the
> > query attribute and doing something like
> >
> > <cfloop query="foo">
> >         <cftry>
> >                 <cfmail from="[EMAIL PROTECTED]" to="#email#" subject="foo">
> >                   ...
> >                 </cfmail>
> >                 <cfcatch type="any"></cfcatch>
> >         </cftry>
> > </cfloop>
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237735
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to