Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

RE: Email::Valid

by KM (Priest)
on Sep 13, 2000 at 19:12 UTC ( #32281=note: print w/ replies, xml ) Need Help??


in reply to Email::Valid

Here is a patch I added to Email::Valid to help with AOL addresses. I submitted it to the author, but don't think it was added. Someone else may find it useful. The issue I had was people from AOL putting in email addresses as me@aol, since many of them seem to think AOL *is* the internet. The project I was working on needed to validate email addresses for a mailing list, so Email::Valid was great, and adding this patch helped me a bit.

--- Valid.pm Fri Jul 9 01:34:55 1999 +++ Valid.pm.new Wed May 10 11:03:20 2000 @@ -186,6 +186,9 @@ my $self = shift; my $addr = shift; + # Since many AOL users think AOL _is_ the internet + # they sometimes leave off the .com, so let's help them + $addr .= ".com" if $addr =~ /aol$/i; $addr =~ s/\s+//g if $addr =~ /aol\.com$/i; $addr =~ s/,/./g if $addr =~ /compuserve\.com$/i; $addr; @@ -431,7 +434,9 @@ Specifies whether calls to address() should attempt to correct common addressing errors. Currently, this results in the removal of spaces in AOL addresses, and the conversion of commas to periods in -Compuserve addresses. The default is false. +Compuserve addresses. This will also tack on a .com to AOL addresses +which fail to have them, ie. user@aol which is common for AOL users t +o +do. The default is false. =item fqdn ( <TRUE>|<FALSE> )

Cheers,
KM


Comment on RE: Email::Valid
Download Code
RE: RE: Email::Valid
by kilinrax (Deacon) on Sep 13, 2000 at 19:29 UTC
    Actually, that code has been included. Obviously someone else did find it useful ;-)
    Just use the -fudge parameter:
    #!/usr/bin/perl -w require 5; use strict; use Email::Valid; my $email = 'demon warez dood@aol.com'; eval { if (my $addr = Email::Valid->address( -address => $email, -mxcheck => 1, -fudge => 1 )) { print "$addr OK\n"; } else { print "$addr failed $Email::Valid::Details check.\n"; } }; warn "an error was encountered: $@" if $@;
      No, that is another feature. That one cleans up spaces and such, my patch fixes foo@aol to foo@aol.com... both useful :)

      Cheers,
      KM

RE: RE: Email::Valid
by turnstep (Parson) on Sep 15, 2000 at 00:58 UTC

    Hrmm..you must be getting some of the smarter AOL users. *grin*. I am lucky if I can get them to give anything but "joe2345" or "lammo234" - an @ sign? What's that? I've written some code that actually checks the IP for people like this and appends "@aol.com" if that is where they are indeed connecting to the Internet through :)

      The question really is: do you want to take the time to send these blokes anything?
Re^2: Email::Valid
by Aristotle (Chancellor) on May 23, 2002 at 09:58 UTC
    The reason is probably that this is not the module's aim. If I were writing an SGML parser, I wouldn't add workarounds to deal with the commonly malformed HTML found out there on the web. Similarly, the HTML::Parser module's docs note that it's not a generic SGML parser because it does include such kludges. In your case, I'd pass Email::Valid the address and given failure, check if it's kludgable and possibly pass it back in for another check.

    Makeshifts last the longest.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://32281]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2014-09-23 01:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (210 votes), past polls