Email Address Validation and Verification

Cecil

19+ years progress programming and still learning.
Hi all.

We where having a problem where our members where entering their email address which they thought to be correct but we had no way to check. Web Services to the rescue.
I've created a simple Web Services Client which will consume a free service to verify an email address.

This code does need internet access for it to work. Also because it's free it comes with NO support and I would like to think that the email addresses are not used for spam.

Code:
/** EMAIL VALIDATION **/

DEFINE VARIABLE hWebService         AS HANDLE      NO-UNDO.
DEFINE VARIABLE hValidateEmailSoap  AS HANDLE      NO-UNDO LABEL 'Email Valid'.
DEFINE VARIABLE chEmailAddress      AS CHARACTER   NO-UNDO LABEL 'Email Address' FORMAT "x(45)".

CREATE SERVER hWebService.

hWebService:CONNECT("-WSDL 'http://www.webservicex.net/ValidateEmail.asmx?WSDL'").

RUN ValidateEmailSoap SET hValidateEmailSoap ON hWebService.

DEFINE VARIABLE lgValidEmail AS LOGICAL NO-UNDO.

FUNCTION IsValidEmail RETURNS LOGICAL
  (INPUT Email AS CHARACTER)
  IN hValidateEmailSoap.

MAIN-BLOCK:
DO ON ERROR UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK
   ON QUIT UNDO main-BLOCK,  LEAVE MAIN-BLOCK
   ON STOP UNDO MAIN-BLOCK,  LEAVE MAIN-BLOCK:
    
    IF VALID-HANDLE(hWebService)        AND 
       VALID-HANDLE(hValidateEmailSoap) AND
       hWebService:CONNECTED() THEN
    DO:

        UPDATE chEmailAddress.
       
        ASSIGN
            lgValidEmail = IsValidEmail(INPUT chEmailAddress ).
            
        DISPLAY chEmailAddress lgValidEmail.        

    END.
END.

DELETE PROCEDURE hValidateEmailSoap.
IF hWebService:CONNECTED() THEN
    hWebService:DISCONNECT().

DELETE OBJECT hWebService.
 

GregTomkins

Active Member
Neato, it actually seems to verify that the address exists, ie. it doesn't just make sure it looks OK syntactically, ie. it caught a minor typo in the spelling of my name.
 

sdjensen

Member
Well I would never use such service on a unknown server.

How can I be sure that you do not save the entered email adress and use it for spam?
 

Cecil

19+ years progress programming and still learning.
So, I wanted to use this code (8 years later) and it's no longer valid. :(
 
Top