Re: [U2] Validating an email adress
> Oops the paste didn't work as expected - > looked good but disappeared when sending - > but here it goes: > > Mats Carlid wrote: > > To check the domain I use: > > EXECUTE \SH -c "nslookup -q=MB \:DOMAIN:\"\ CAPTURING RESULT nslookup is 'going away' and is only maintained for compatibility. I would recommend using the 'host' or 'dig' commands instead. When I run nslookup, I get this: Note: nslookup is deprecated and may be removed from future releases. Consider using the `dig' or `host' programs instead. Run nslookup with the `-sil[ent]' option to prevent this message from appearing. Of course, your mileage may vary, depending on your OS. Plus, some OSes don't even have dig (AIX for one). Karl > > > IF (INDEX(RESULT,"Non-existent",1)) THEN > ERR.M = " Mejladressens domdn finns inte! " > RETURN (1) > END > > >>this for unix only and You may have to add the path to nslookup. >> >>If someone does not understand the swedish message - if any -:) >>it translates to "Nonexistent mail adress domain" >> >>-- mats >>--- > --- > u2-users mailing list > u2-users@listserver.u2ug.org > To unsubscribe please visit http://listserver.u2ug.org/ > -- Karl L. Pearson Director of IT, ATS Industrial Supply Direct: 801-978-4429 Toll-free: 800-789-9300 1,29 Fax: 801-972-3888 http://www.atsindustrial.com [EMAIL PROTECTED] --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
Re: [U2] Validating an email adress
Oops the paste didn't work as expected - looked good but disappeared when sending - but here it goes: Mats Carlid wrote: To check the domain I use: EXECUTE \SH -c "nslookup -q=MB \:DOMAIN:\"\ CAPTURING RESULT IF (INDEX(RESULT,"Non-existent",1)) THEN ERR.M = " Mejladressens domdn finns inte! " RETURN (1) END this for unix only and You may have to add the path to nslookup. If someone does not understand the swedish message - if any -:) it translates to "Nonexistent mail adress domain" -- mats --- --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
Re: [U2] Validating an email adress
To check the domain I use this for unix only and You may have to add the path to nslookup. If someone does not understand the swedish message - if any -:) it translates to "Nonexistent mail adress domain" -- mats --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Validating an email adress
Claus Derlien wrote: >...i need a neat way to validate an email adress, so i > can return an error if it contains any illegal chars... Can U2 use Regular Expressions (RegExp)? As mentioned, there are many RFC rules that must be met in order for an e-mail address to be considered valid. I found a nice regular expression that seems to check many of them. In order to execute regular expressions I'll wrap them in a little Perl script and then call them from MV code. This can be done for a LOT of functions so that we don't feel compelled to write MV BASIC functions when there are perfectly good routines available in open source. Here's the code, save as mailok.pl in Windows or *nix: -- #!/usr/local/bin/perl # Change above line in *nix as required my $email = $ARGV[0]; my $mask = '^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)'; $mask .= '*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$'; # mask broken into two lines just to avoid wrapping when printed if ($email =~ $mask) { print "OK $1 $2 $3"; } else { print "NO"; } -- To call it from BASIC: ADDR = "[EMAIL PROTECTED]" ; * must be in lowercase CMD = 'mailok.pl ':ADDR RESULT = UVRunCommand(CMD) Or for *nix, use PERFORM CMD CAPTURING RESULT (Or EXECUTE depending on your MV flavor, etc) I don't want to get into how to configure Perl, this is on using Perl from BASIC, but depending on how you have Perl setup, and your OS, you may need CMD to be something like: CMD = 'c:\perl\perl.exe mailok.pl ':ADDR Or for *nix: CMD = 'perl /var/lib/myperlstuff/mailok.pl ':ADDR RESULT now has 1 field if it was bad or 4 space-delimited fields if it was OK. Param1 = NO if it was a bad address or OK if it was good. Param2 is the part before the "@". Param3 is the domain without the TLD (the part before the period). Param4 is the TLD (Top Level Domain, COM, TV, MY, NAME, GOV, EDU, etc). These params are provided simply to be informational. Why use Perl for a little ditty like this? - If you improve the script then no BASIC code changes are required, your application improves without a recompile. - The exact same routine can be used for your website, or from other programs on your system. - The same code can be used with any MV flavor. It's a shame when good MV algorithms have to be re-written just because of syntax issues. HTH Tony Gravagno Nebula Research and Development TG@ removethisNebula-RnD .com --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
Re: [U2] Validating an email adress
Claus, When matching, you can match multiple patterns if you separate them with @VM. Eg: "1N0N":@VM:"'N/A'" matches one or more numerics or N/A. try this (the logic from my email address validation subroutine): The string must contain @ (unless you allow sending to users in your local domain without suppling the hostname). Validate the local part and hostpart separately ([EMAIL PROTECTED]). Validate localpart: - May not be empty - No longer than 64 characters - Unquoted, Alphanumerics and !#$%&'*+-/=?^_`.{|}~ are all valid - May not start or end with . and may not contain .. - Any ASCII character may appear quoted with \ or if the localpart is a quoted string "" Validate hostpart: - May be an IP address if surrounded by square brackets ie: MATCH "'['1N0N'.'1N0N'.'1N0N'.'1N0N']'" You then need to make sure that no numeric component is greater than 255. - Must contain at least one . - Cannot be longer than 255 characters - Each individual domain component (where hostpart is DOMAINCOMPONENT.DOMAINCOMPONENT.) may not be longer than 63 characters. - You cannot have 0 length domain component (..) although you can have a trailing . - The final DOMAINCOMPONENT (the .au, .com, .dk) cannot be all numeric - DOMAINCOMPONENT may not start or end with - - DOMAINCOMPONENT may only contain ascii alphanumerics and - I then uses sockets to query our dns server and check that there is a Type A record for the domain. I believe this should also work for the new internatianalised domain names but I have never tested it. HTH, Craig --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Validating an email adress
>From: [EMAIL PROTECTED] > >In a message dated 5/3/2005 4:43:20 AM Pacific Daylight Time, >[EMAIL PROTECTED] writes: > >> GoodEmail = ( Convert("_.1234567890","",Email) Matches >> "1A0A'@'1A0A") > >Change that patter to 1X0X'@'1X0X'.'1X0X > >1A0A Would mean you're disallowing emails addresses with >numbers in them or starting with numbers either > >Will Johnson But that's why he's changing all of the numbers to 'X'. I think the numeric (0N) might pass some characters that are invalid in an e-mail address. In either case it's a pretty "quick and dirty" test. Colin Alfke Calgary Canada --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
Re: [U2] Validating an email adress
Wouldn't you also have to check for email addresses with this pattern 1X0X'@'1X0X'.'1X0X'.'1X0X and other variants? Note the TO: for this email list, for one example. Karl > In a message dated 5/3/2005 4:43:20 AM Pacific Daylight Time, > [EMAIL PROTECTED] writes: > > >> GoodEmail = ( Convert("_.1234567890","",Email) Matches >> "1A0A'@'1A0A") > > Change that patter to 1X0X'@'1X0X'.'1X0X > > 1A0A Would mean you're disallowing emails addresses with numbers in them > or > starting with numbers either > > Will Johnson > Fast Forward Technologies > --- > u2-users mailing list > u2-users@listserver.u2ug.org > To unsubscribe please visit http://listserver.u2ug.org/ > -- Karl L. Pearson Director of IT, ATS Industrial Supply Direct: 801-978-4429 Toll-free: 800-789-9300 1,29 Fax: 801-972-3888 http://www.atsindustrial.com [EMAIL PROTECTED] --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
Re: [U2] Validating an email adress
In a message dated 5/3/2005 4:43:20 AM Pacific Daylight Time, [EMAIL PROTECTED] writes: > GoodEmail = ( Convert("_.1234567890","",Email) Matches > "1A0A'@'1A0A") Change that patter to 1X0X'@'1X0X'.'1X0X 1A0A Would mean you're disallowing emails addresses with numbers in them or starting with numbers either Will Johnson Fast Forward Technologies --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Validating an email adress
There are other rules to being a valid email address IIRC. I remember doing some of this in the past, and it can get complicated. For example a single period is valid, but 2 periods in a row is not. Also period dash ".-" and dash period "-." isn't valid either. Back then for the host/domain portion the top level domain could only be 2 or 3 characters. I know it's more now (ie .info). Names (the part before the @) must end in a letter or number. Etc... So you might want to divide on the "@" into a name portion and a host/domain portion and test them individually. I finally ended up writing code to get the MX for the domain, opening a connection to it, tell it the recipient's name and close the connection not sending any actual email. If everything passed, I was fairly safe that that the email was at least valid for someone. But I didn't do with is UV/UD, it was on a web server, could have been perl or more likely PHP. I probably have that code somewhere if it would help. Robert -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Claus Derlien Sent: Tuesday, May 03, 2005 9:36 AM To: u2-users@listserver.u2ug.org Subject: RE: [U2] Validating an email adress Both solution seems to work nicely, but i will stick to the pattern matching solution, time to test!! :-)) thanks a lot claus derlien > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Brian Leach > Sent: Tuesday, May 03, 2005 1:34 PM > To: u2-users@listserver.u2ug.org > Subject: RE: [U2] Validating an email adress > > > Claus, > > Since the MATCH operator handles alphas OR numerics and not > both, this is > the closest I can get using a pattern match: > > GoodEmail = ( Convert("_.1234567890","",Email) Matches > "1A0A'@'1A0A") > > Brian Frie Funktionfrer - faglig organisation og tvfrfaglig a-kasse - www.f-f.dk *** Denne email og alle filer vedlagt som bilag kan indeholde fortroligt materiale, der kun er beregnet for adressaten, og maa ikke udleveres eller kopieres til uvedkommende. Har De ved en fejltagelse modtaget denne email, bedes De venligst omgaaende meddele os dette pr. telefon : 6313 8550. Paa forhaand tak. *** This email and any files transmitted with it may contain confidential information intended for the addressee(s) only. The information is not to be surrendered or copied to unauthorised persons. If you have received this communication in error, please notify us immediately by telephone: +45 6313 8550. Thank you. *** --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
Re: [U2] Validating an email adress
rfc 2822 contains the entire syntax of what's alowed and whats not (http://www.faqs.org/rfcs/rfc822.html) allowed in an email. Overkill, but interesting. And there's a perl module (Email:Address) to do 2822 validating as well, if you need be able to validate any possible allowed email. However, mostly what the others have said on this will probably suffice. John On Tue, 3 May 2005, Claus Derlien wrote: > Hi folks, > > I'm completely new to the use of pattern matching in UniVerse, > and i need a neat way to validate an email adress, so i can return an error > if it contains any illegal chars, i guess legal chars is a-z,A-Z,0-9,.-_@ > > does anyone have nice way to do this ?? > > best regards from sunny denmark > > Claus Derlien > edb-afdelingen > direkte : 63 13 86 69 > email : [EMAIL PROTECTED] > > Frie Funktionfrer - faglig organisation og tvfrfaglig a-kasse - www.f-f.dk > > *** > Denne email og alle filer vedlagt som bilag kan indeholde fortroligt > materiale, der kun er beregnet for adressaten, > og maa ikke udleveres eller kopieres til uvedkommende. Har De ved en > fejltagelse modtaget denne email, bedes > De venligst omgaaende meddele os dette pr. telefon : 6313 8550. Paa forhaand > tak. > *** > This email and any files transmitted with it may contain confidential > information intended for the addressee(s) only. > The information is not to be surrendered or copied to unauthorised persons. > If you have received this > communication in error, please notify us immediately by telephone: +45 6313 > 8550. Thank you. > *** > --- > u2-users mailing list > u2-users@listserver.u2ug.org > To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Validating an email adress
Both solution seems to work nicely, but i will stick to the pattern matching solution, time to test!! :-)) thanks a lot claus derlien > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Brian Leach > Sent: Tuesday, May 03, 2005 1:34 PM > To: u2-users@listserver.u2ug.org > Subject: RE: [U2] Validating an email adress > > > Claus, > > Since the MATCH operator handles alphas OR numerics and not > both, this is > the closest I can get using a pattern match: > > GoodEmail = ( Convert("_.1234567890","",Email) Matches > "1A0A'@'1A0A") > > Brian Frie Funktionfrer - faglig organisation og tvfrfaglig a-kasse - www.f-f.dk *** Denne email og alle filer vedlagt som bilag kan indeholde fortroligt materiale, der kun er beregnet for adressaten, og maa ikke udleveres eller kopieres til uvedkommende. Har De ved en fejltagelse modtaget denne email, bedes De venligst omgaaende meddele os dette pr. telefon : 6313 8550. Paa forhaand tak. *** This email and any files transmitted with it may contain confidential information intended for the addressee(s) only. The information is not to be surrendered or copied to unauthorised persons. If you have received this communication in error, please notify us immediately by telephone: +45 6313 8550. Thank you. *** --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Validating an email adress
How about this: GOOD.CHARS = "abcdefghijklmnopqrstuvwxyz" GOOD.CHARS := "ABCDEFGHIJKLMNOPQRSTUVWXYZ" GOOD.CHARS := "0123456789.-_@" INPUT EMAIL.ADDR TEST.ADDR = EMAIL.ADDR CONVERT GOOD.CHARS TO "" IN TEST.ADDR IF TEST.ADDR # "" THEN No, No, Bad User Do It Over END Hope this helps! Jeff Fitzgerald Fitzgerald & Long, Inc. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Claus Derlien Sent: Tuesday, May 03, 2005 2:41 AM To: u2-users@listserver.u2ug.org Subject: [U2] Validating an email adress Hi folks, I'm completely new to the use of pattern matching in UniVerse, and i need a neat way to validate an email adress, so i can return an error if it contains any illegal chars, i guess legal chars is a-z,A-Z,0-9,.-_@ does anyone have nice way to do this ?? best regards from sunny denmark Claus Derlien edb-afdelingen direkte : 63 13 86 69 email : [EMAIL PROTECTED] Frie Funktionfrer - faglig organisation og tvfrfaglig a-kasse - www.f-f.dk *** Denne email og alle filer vedlagt som bilag kan indeholde fortroligt materiale, der kun er beregnet for adressaten, og maa ikke udleveres eller kopieres til uvedkommende. Har De ved en fejltagelse modtaget denne email, bedes De venligst omgaaende meddele os dette pr. telefon : 6313 8550. Paa forhaand tak. *** This email and any files transmitted with it may contain confidential information intended for the addressee(s) only. The information is not to be surrendered or copied to unauthorised persons. If you have received this communication in error, please notify us immediately by telephone: +45 6313 8550. Thank you. *** --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Validating an email adress
Claus, Since the MATCH operator handles alphas OR numerics and not both, this is the closest I can get using a pattern match: GoodEmail = ( Convert("_.1234567890","",Email) Matches "1A0A'@'1A0A") Brian -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Claus Derlien Sent: 03 May 2005 09:09 To: u2-users@listserver.u2ug.org Subject: [U2] Validating an email adress Hi folks, I'm completely new to the use of pattern matching in UniVerse, and i need a neat way to validate an email adress, so i can return an error if it contains any illegal chars, i guess legal chars is a-z,A-Z,0-9,.-_@ does anyone have nice way to do this ?? best regards from sunny denmark Claus Derlien edb-afdelingen direkte : 63 13 86 69 email : [EMAIL PROTECTED] Frie Funktionfrer - faglig organisation og tvfrfaglig a-kasse - www.f-f.dk *** Denne email og alle filer vedlagt som bilag kan indeholde fortroligt materiale, der kun er beregnet for adressaten, og maa ikke udleveres eller kopieres til uvedkommende. Har De ved en fejltagelse modtaget denne email, bedes De venligst omgaaende meddele os dette pr. telefon : 6313 8550. Paa forhaand tak. *** This email and any files transmitted with it may contain confidential information intended for the addressee(s) only. The information is not to be surrendered or copied to unauthorised persons. If you have received this communication in error, please notify us immediately by telephone: +45 6313 8550. Thank you. *** --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Validating an email adress
Just create a loop in basic and convert each character to its ascii value and then just check your range of allowed values. INPUT EMAIL.ADDRESS BAD.EMAIL = @FALSE FOR LETTER=1 TO LEN(EMAIL.ADDRESS) TEST=SEQ(EMAIL.ADDRESS[LETTER,1]) IF TEST<32 OR TEST>126 THEN;*just check what every you need here BAD.EMAIL = @TRUE ;*this is not what you want, but just EXIT;*add your tweaks here END NEXT LETTER IF BAD.EMAIL THEN PRINT "YOUR EMAIL IS INVALID" END ANTHONY -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Claus Derlien Sent: Tuesday, May 03, 2005 4:09 AM To: u2-users@listserver.u2ug.org Subject: [U2] Validating an email adress Hi folks, I'm completely new to the use of pattern matching in UniVerse, and i need a neat way to validate an email adress, so i can return an error if it contains any illegal chars, i guess legal chars is a-z,A-Z,0-9,.-_@ does anyone have nice way to do this ?? best regards from sunny denmark Claus Derlien edb-afdelingen direkte : 63 13 86 69 email : [EMAIL PROTECTED] Frie Funktionfrer - faglig organisation og tvfrfaglig a-kasse - www.f-f.dk *** Denne email og alle filer vedlagt som bilag kan indeholde fortroligt materiale, der kun er beregnet for adressaten, og maa ikke udleveres eller kopieres til uvedkommende. Har De ved en fejltagelse modtaget denne email, bedes De venligst omgaaende meddele os dette pr. telefon : 6313 8550. Paa forhaand tak. *** This email and any files transmitted with it may contain confidential information intended for the addressee(s) only. The information is not to be surrendered or copied to unauthorised persons. If you have received this communication in error, please notify us immediately by telephone: +45 6313 8550. Thank you. *** --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.1 - Release Date: 5/2/2005 -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.1 - Release Date: 5/2/2005 --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
[U2] Validating an email adress
Hi folks, I'm completely new to the use of pattern matching in UniVerse, and i need a neat way to validate an email adress, so i can return an error if it contains any illegal chars, i guess legal chars is a-z,A-Z,0-9,.-_@ does anyone have nice way to do this ?? best regards from sunny denmark Claus Derlien edb-afdelingen direkte : 63 13 86 69 email : [EMAIL PROTECTED] Frie Funktionfrer - faglig organisation og tvfrfaglig a-kasse - www.f-f.dk *** Denne email og alle filer vedlagt som bilag kan indeholde fortroligt materiale, der kun er beregnet for adressaten, og maa ikke udleveres eller kopieres til uvedkommende. Har De ved en fejltagelse modtaget denne email, bedes De venligst omgaaende meddele os dette pr. telefon : 6313 8550. Paa forhaand tak. *** This email and any files transmitted with it may contain confidential information intended for the addressee(s) only. The information is not to be surrendered or copied to unauthorised persons. If you have received this communication in error, please notify us immediately by telephone: +45 6313 8550. Thank you. *** --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/