Here's my tcf for checking for invalid emails. I catches a lot
of common mistakes.

Stefan


>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED]]On Behalf Of Dan Stein
>Sent: Monday, June 03, 2002 5:48 PM
>To: Multiple recipients of list witango-talk
>Subject: Witango-Talk: Email validation
>
>
>Anyone have a snippet to validate email address when it is entered in a form
>make sure it is valid format.
>
>
>--
>Dan Stein
>Digital Software Solutions
>799 Evergreen Circle
>Telford PA 18969
>Land: 215-799-0192
>Mobile: 610-256-2843
>FMP, WiTango, EDI,SQL 2000
>[EMAIL PROTECTED]
>www.dss-db.com
>
>
>________________________________________________________________________
>TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
>                 with unsubscribe witango-talk in the message body

========================================================
Database WebWorks: Dynamic web sites through database integration
http://www.DatabaseWebWorks.com
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE TCF SYSTEM "tango.dtd" >
<TCF Version="0x02000002">
        <Comments />

        <!--Defined Classes-->
        <Classes>
                <ClassDef>
                        <Name>emailcheck</Name>

                        <!--Class constructor-->
                        <On_Create>
                                <Implementation />
                        </On_Create>

                        <!--Class destructor-->
                        <On_Destroy>
                                <Implementation />
                        </On_Destroy>

                        <!--Methods of this class-->
                        <Methods>
                                <MethodDef>
                                        <Name>Is_Email_Invalid</Name>
                                        <MethodParameterList>
                                                <MethodParameterItem DataType="Text" 
Direction="In">
                                                        <Name>Email_Address</Name>
                                                </MethodParameterItem>
                                        </MethodParameterList>
                                        <Implementation>
                                                <ActionRef 
Ref="emailcheck.Is_Email_Invalid.Check_Email_Validity" />
                                        </Implementation>
                                        <ReturnValueName>Invalid</ReturnValueName>
                                        <ReturnValueType>Text</ReturnValueType>
                                </MethodDef>
                        </Methods>

                        <!--Instance variables for this class-->
                        <Variables />
                </ClassDef>
        </Classes>

        <!--Program actions-->
        <Actions>
                <ResultAction ID="emailcheck.Is_Email_Invalid.Check_Email_Validity" 
Sig="null">
                        <ResultsOutput 
Ref="emailcheck.Is_Email_Invalid.Check_Email_Validity.Results" />
                </ResultAction>
        </Actions>

        <!--Data sources-->
        <DataSources />

        <!--Output blocks-->
        <Outputs>
                <Output ID="emailcheck.Is_Email_Invalid.Check_Email_Validity.Results" 
Type="HTML"><![CDATA[<@ASSIGN method$Invalid 0>

<@IF Expr='<@LOCATE str=@@method$Email_Address findstr="@"> = 0'>
        <@ASSIGN method$Invalid 1>
<@ELSEIF Expr='<@LOCATE str=@@method$Email_Address findstr=" "> != 0'>
        <@ASSIGN method$Invalid 1>
<@ELSEIF Expr='<@LOCATE str=@@method$Email_Address findstr=","> != 0'>
        <@ASSIGN method$Invalid 1>
<@ELSEIF Expr='@@method$Email_Address = "www.*"'>
        <@ASSIGN method$Invalid 1>
<@ELSE>
        <@assign local$parts <@tokenize value=@@method$Email_Address chars="@">>
        <@IF Expr='<@locate str=@@local$parts[1,2] findstr="."> = 0'>
                <@ASSIGN method$Invalid 1>
        </@IF>
</@IF>
]]></Output>
        </Outputs>
</TCF>

Reply via email to