Pseudo E-Mail Address validation
Hi all, For a subscription tool of a mailing list I'd like to quick-check the e-mail address our users type. Is there a little product/method etc. available that does this? I know that you can only be sure whether an e-mail address exists or not, when you actually send a mail to the user, but a quick-n-dirty check would be nice. Maybe even complete RFC-compliancy as implemented in some Perl-Modules? (spaces, "@" sign, dot-notation etc.) Hoping for an answer, Martin
At 11/21/00 04:27 PM, Martin Winkler wrote:
For a subscription tool of a mailing list I'd like to quick-check the e-mail address our users type.
As a check on whether an email address *looks* OK, I use the following External Method. If ICANN really approves TLDs that are other than 2 or 3 characters long then the {2,3} will have to be changed. Warning: Some mail software between you and me may break up lines in the code. There are two executable lines, one starts with "m =" and the very next line starts with "return". There are no blanks in the r'...' string. ---------------- import re def wellformedEmail(self, address): """ return true if email address appears to be well formed """ m = re.search(r'^[_a-z0-9-]+(\.[_a-z0-9-]+)*@([0-9a-z][0-9a-z-]*[0-9a-z]\.)+[a-z]{2,3}$', address, re.IGNORECASE) return m != None and m.group() == address -- Dennis Nichols nichols@tradingconnections.com
e-mail address exists or not, when you actually send a mail to the user, but a quick-n-dirty check would be nice. Maybe even complete RFC-compliancy as implemented in some Perl-Modules? (spaces, "@" sign, dot-notation etc.)
There is a "monster" regular expression made by Tom Christiansen I think. A link is on http://www.perl.com/pub/doc/manual/html/pod/perlfaq9.html#How_do_I_check_a_v... The regular expression may be used in Python too I think. Regards, Frank
At 10:58 22.11.2000, Frank Tegtmeyer wrote:
There is a "monster" regular expression made by Tom Christiansen I think. A link is on http://www.perl.com/pub/doc/manual/html/pod/perlfaq9.html#How_do_I_check_a_v...
Yes, I know this link - especially the absolutely voodoo-style regex by J. Friedl ("Mastering Regular Expressions", O'Reilly). I tried to "pythonify" the regex, but I failed. Python exits with some strange errors. Maybe Python is not that exceptionally good in regex as Perl? *duck* So I'm using the simpler method proposed by Dennis Nichols in this thread. Thanks Dennis! Martin
Martin Winkler wrote:
Hi all,
For a subscription tool of a mailing list I'd like to quick-check the e-mail address our users type. Is there a little product/method etc. available that does this? I know that you can only be sure whether an e-mail address exists or not, when you actually send a mail to the user, but a quick-n-dirty check would be nice. Maybe even complete RFC-compliancy as implemented in some Perl-Modules? (spaces, "@" sign, dot-notation etc.)
Hoping for an answer,
Martin
not feature complete but def. qualifying as a quick-n-dirty-check <dtml-if "'@' in email_addr and '.' in email_addr and not ' ' in email_addr"> valid <dtml-var email_addr> </dtml-if> solves most of my concerns with valid email addrs kapil
participants (4)
-
Dennis Nichols -
Ender -
Frank Tegtmeyer -
Martin Winkler