× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Glenn,

> I can't find it. :-(
>
>> Scott Klement wrote an email validater called VALMAIL. A
>> search through the archives should provide a link to it.

This is a somewhat tricky question because there are very few rules involved in the syntax of an e-mail address. Basically, anything can precede the '@' symbol, as long as it's properly quoted, and is allowed by the destination e-mail server. The part after the @ symbol must be a valid TCP/IP domain name. So that's not a lot of validation!

My first approach to the problem was to check the syntax (Again, that doesn't provide much help, since the syntax is so broad) and then do a DNS lookup on the domain name portion. That way, you know that it's a valid domain name that's available on the Internet.

That code was called VALMAIL (it's the one Matt mentioned) and is available to System iNetwork members (a free, "Associate" membership is all you need) at the following link:
http://www.iseriesnetwork.com/article.cfm?id=17633

As I recall, there's an issue with the GetMX routine in that service program, but it only surfaces with some DNS servers. The solution (to make it work everywhere) is to add a '.' to the end of the domain name... it should be as easy as changing this line of code:

c eval count = GetMX(dom: MXSIZE: mx: pty)

to this:
c eval count = GetMX(dom+'.': MXSIZE: mx: pty)

The problem with that method is that it has to do a DNS lookup on every e-mail address you enter... That can be slow (depending on how fast the addresses are entered) and it also can produce "false failures" if your Internet connection happens to be down, or if the company who owns the e-mail address has their DNS servers down for maintenance or something, it'll come up as a "bad address".

The other common method is to check the basic syntax using a regular expression. Here's an article I wrote (also requires a free, "associate" subscription to SystemiNetwork.com) that demonstrates that technique from RPG:
http://www.systeminetwork.com/article.cfm?id=52826

The regular expression method only checks the syntax (no DNS lookup) but is stricter. Theoretically, it can reject a valid e-mail address -- though, most of the invalid ones that would fail the test are so obscure that it doesn't make much difference.

Good luck


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.