|
This is a multipart message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
pinging ibm.com fails. They must have blocked ping. But this will work:
/eject
P*---------------------------------------------------------------------
P* Procedure name: VALIDEMAILADDR
P* Purpose: Validates email address
P* Returns: '1'=Yes the email address is valid, '0'=No it is
not
P* Parameter: emailaddr => email address
P*---------------------------------------------------------------------
P VALIDEMAILADDR B EXPORT
D VALIDEMAILADDR PI N
D EmailAddr LIKE(login.logemail) CONST
D* Local fields
D rValidEmailAdr S N
D DomainName s 100a
D Start s 10i 0
/free
Start = 1 + %check('@':EmailAddr);
Select;
When Start=1; // no @ found
rValidEmailAdr=*off;
When Start>=%len(EmailAddr); // in last position, going further
may bomb program
rValidEmailAdr=*off;
Other;
DomainName=%trim(%subst(EmailAddr:start:%len(EmailAddr)-start+1));
cmd='PING RMTSYS(' + %trim(DomainName) +
') MSGMODE(*QUIET *ESCAPE)');
ErrorFlag=system(%trim(cmd));
Select;
When ErrorFlag=*zeros;
rValidEmailAdr=*on;
Other;
Select;
When ErrorCPF='TCP3202'; // unknown location, bad
rValidEmailAdr=*off;
When ErrorCPF='TCP3210'; // 0 of 5 attempts worked, ping might
be
// blocked. We'll accept this.
rValidEmailAdr=*on;
Other; // discard all other errors
rValidEmailAdr=*off;
EndSl;
EndSl;
EndSl;
return rValidEmailAdr;
/end-free
P VALIDEMAILADDR E
Rob Berendt
--
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety."
Benjamin Franklin
rob@dekko.com
Sent by: midrange-l-admin@midrange.com
04/25/2002 02:11 PM
Please respond to midrange-l
To: midrange-l@midrange.com
cc:
Fax to:
Subject: Validating email addresses
This is a multipart message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
I was researching the thread "Validating email addresses" from
http://archive.midrange.com/midrange-l/200006/msg01538.html
The solutions:
- ruled out "finger" because often blocked
- suggested gethostbyname or gethostbyaddr
- suggested using a reply to address to process bounced back emails
- checking internet tables of blocked email addresses
There didn't seem to be anything, other than the bounce back, to truly
validate an email address.
My question is the following acceptable
PING RMTSYS(&domainpart) MSGMODE(*QUIET *ESCAPE)
MONMSG TCP3210
versus the hassle of coding gethostbyname, or is ping often blocked?
Correct me if I am wrong but if I entered a nonexistent host table entry
like ralph.huey then gethostbyname would find it since there is a host
table, or a DNS entry, for ralph.huey. Granted, you'd have to have a
really hosed up host table for this to be of a real concern. But ping
would report the error.
Rob Berendt
--
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety."
Benjamin Franklin
_______________________________________________
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l
or email: MIDRANGE-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.