2 Replies Latest reply on Jan 21, 2014 11:55 AM by MattLeach

    Email Verification

    MattLeach

      I seem to remember about a year or two ago seeing a post or blog on how to setup a calculation (or it may have been a custom function) that would verify that the syntax of an email address that was entered is correct. Would anyone happen to have a link to this? Did a few searches and came up blank.

       

      Thanks

        • 1. Re: Email Verification
          taylorsharpe

          Custom Function at:  https://www.briandunning.com/cf/360

           

           

          Or here is a validation I did for an email field:

           

           

           

          Let (

              [

              theEmail = [insert name of field to validate] ;

              _validDomainCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-." ;

              _invalidLocalCharacters = "!\"#$%&'*,/:;<>?@[\]^`{}|~" ; // from http://www.remote.org/jochen/mail/info/chars.html

              _theLocalPart = Left ( theEmail ; Position ( theEmail ; "@" ; 1; 1 ) - 1 ) ;

              _theDomainPart =  Right ( theEmail ; Length ( theEmail ) - Position ( theEmail ; "@" ; 1; 1 )  ) ;

              _theTopLevelDomain = RightWords ( Substitute ( _theDomainPart ; "." ; " " ) ; 1 ) ;

              _ValidTopLevelDomains = "AC¶AD¶AE¶AERO¶AF¶AG¶AI¶AL¶AM¶AN¶AO¶AQ¶AR¶ARPA¶AS¶AT¶AU¶AW¶AZ¶BA¶BB¶BD¶BE¶BF¶BG¶BH¶BI¶BIZ¶BJ¶BM¶BN¶BO¶BR¶BS¶BT¶BV¶BW¶BY¶BZ¶CA¶CC¶CD¶CF¶CG¶CH¶CI¶CK¶CL¶CM¶CN¶CO¶COM¶COOP¶CR¶CU¶CV¶CX¶CY¶CZ¶DE¶DJ¶DK¶DM¶DO¶DZ¶EC¶EDU¶EE¶EG¶ER¶ES¶ET¶EU¶FI¶FJ¶FK¶FM¶FO¶FR¶GA¶GB¶GD¶GE¶GF¶GG¶GH¶GI¶GL¶GM¶GN¶GOV¶GP¶GQ¶GR¶GS¶GT¶GU¶GW¶GY¶HK¶HM¶HN¶HR¶HT¶HU¶ID¶IE¶IL¶IM¶IN¶INFO¶INT¶IO¶IQ¶IR¶IS¶IT¶JE¶JM¶JO¶JOBS¶JP¶KE¶KG¶KH¶KI¶KM¶KN¶KR¶KW¶KY¶KZ¶LA¶LB¶LC¶LI¶LK¶LR¶LS¶LT¶LU¶LV¶LY¶MA¶MC¶MD¶MG¶MH¶MIL¶MK¶ML¶MM¶MN¶MO¶MP¶MQ¶MR¶MS¶MT¶MU¶MUSEUM¶MV¶MW¶MX¶MY¶MZ¶NA¶NAME¶NC¶NE¶NET¶NF¶NG¶NI¶NL¶NO¶NP¶NR¶NU¶NZ¶OM¶ORG¶PA¶PE¶PF¶PG¶PH¶PK¶PL¶PM¶PN¶PR¶PRO¶PS¶PT¶PW¶PY¶QA¶RE¶RO¶RU¶RW¶SA¶SB¶SC¶SD¶SE¶SG¶SH¶SI¶SJ¶SK¶SL¶SM¶SN¶SO¶SR¶ST¶SU¶SV¶SY¶SZ¶TC¶TD¶TF¶TG¶TH¶TJ¶TK¶TL¶TM¶TN¶TO¶TP¶TR¶TRAVEL¶TT¶TV¶TW¶TZ¶UA¶UG¶UK¶UM¶US¶UY¶UZ¶VA¶VC¶VE¶VG¶VI¶VN¶VU¶WF¶WS¶YE¶YT¶YU¶ZA¶ZM¶ZW"

              ] ;

           

           

              Case (

                  IsEmpty ( theEmail ) ; 1 /*"no value supplied"*/    ;

                  PatternCount ( theEmail ; "@" ) <> 1 ; "invalid address" ;

                  PatternCount ( _theDomainPart ; "." ) = 0 ; "invalid formatting" ;

                  Length ( Filter ( _theLocalPart ; _invalidLocalCharacters ) ) ;

                      "invalid characters in the local part" ;

                  Length ( Filter ( _theDomainPart ; _validDomainCharacters ) ) <> Length ( _theDomainPart ) ;

                      "invalid characters in the domain part" ;

                  Left ( _theLocalPart ; 1) = "." or

                      Right ( _theLocalPart ; 1 ) = "." or

                      Left ( _theDomainPart ; 1 ) = "." or

                      Right ( _theDomainPart ; 1 ) = "." ;

                      "invalid formatting" ;

                 IsEmpty ( FilterValues ( _theTopLevelDomain ; _ValidTopLevelDomains ) ) ; "invalid top level domain" ;

           

                  1

              )

          )

           

           

           

           

          /*

          Name:

          EmailIsValid

           

           

          History:

          Created by Paul Turnbull

          Creation Date: 13-10-2005

          Modified Date: 13-11-2005 paul@fourofus.ca - fixed numerous bugs.

           

           

          Purpose: Returns True if the email supplied is valid an error message if it is not.

           

           

          Parameters:

          theEmail

           

           

          Important Notes:

          List of TLDs from http://data.iana.org/TLD/tlds-alpha-by-domain.txt

          Will not handle urls in the form contact@domain.com/some.name although you could edit to handle this if you like.

          */

          • 2. Re: Email Verification
            MattLeach

            Thanks taylor, i was even at that site, mustve glanced over it