NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: CaseyR on September 27, 2013, 11:52:53 AM

Title: Validating email address
Post by: CaseyR on September 27, 2013, 11:52:53 AM
Email is a critical part of our application.   Is there any function that validates an email address?  I have simple tests like includes an @ and has a period after it, but wondered if there was anything more comprehensive.  Even better, a way to confirm the address is actually working.

Any suggestions, greatly appreciated.  Thanks. 
Title: Re: Validating email address
Post by: urayoan on September 27, 2013, 09:56:03 PM
Casey, in a form i set a local variable to loc:eMailFrom (entry field) and in embed point Validate All the following code

X# =  MATCH(UPPER(CLIP(loc:eMailFrom)),|
    '^[-A-Z0-9._]+@{{[-A-Z0-9._]+\.}+[A-Z][A-Z][A-Z]?[A-Z]?$', Match:Regular)

IF X# <> 1             
  loc:invalid = 'loc:eMailFrom'
  p_web.SetValue('retry','EmailFormControl')
  loc:Alert = 'Invalid eMail.'       
ELSE 
!Procedure to send the eMail
  SendEmail(eMailParams)
END!If
Title: Re: Validating email address
Post by: CaseyR on September 29, 2013, 02:40:16 PM
Thanks, urayoan,  I will give it a shot.
Title: Re: Validating email address
Post by: terryd on September 30, 2013, 04:09:38 AM
Also since String Theory is now required by NTalk you could use it to do the same checking