in reply to Re: Expressing myself
in thread Expressing myself

What about <root@astlavista.box.sk>?

Remember, even if an email address passes a regex, you do not necessarily know that it is indeed a VALID email address.

Email capt3043@yahoo.com if you don't believe me.

Replies are listed 'Best First'.
Re: (jeffa) Re: Re: Expressing myself
by eejack (Hermit) on May 12, 2001 at 08:45 UTC
    I agree it is not a perfect solution.

    To account for all the possible email addresses would be very difficult, made improbably more twisted trying to verify them as you point out.

    The closest I have gotten was a regex that pulled out the email, then attempted to send mail to the email account and stopping at the point where the smtp server would accept data and dropping the connection. I did this because so many mail servers were denying vrfy.

    However - now many mail servers are accepting *any* mail, then deciding whether or not to deliver or return. AOL is the big one doing this. I have my mail servers set up to do this as well on some domains (using ruleset 6 IIRC) and catchalls that dump non-valid email into the bit bucket on my ntmailserver.

    And honestly, I found my method, while functional, intrinsictly rude - so I stopped using it.

    The very best way to verify is to try your best in parsing, send an email for validation and keep track of responses and bounces.

    But thank you for bringing it up. The person who was asking didn't get my best answer, instead got my quick answer.

    Perhaps a better example with better explanations would have been more appropriate on my part - or a link to one of the many other places that would explain it better than I could. Unfortunately I have a difficult time explaining things well. It's a learning experience for everyone...:)

    Until I can dig up a link or two...

    #!/usr/bin/perl -w @test = ( '0email user <emailuser@emailaddress.com>', '1email user <email.user@emailaddress.com>', '2email user <emailuser@email-address.com>', '3email user <emailuser@mail.email-address.com>', '4email user <email.user@email-address>', '5email user <email.user@email.addres.scom>', '6email user <email.user@emailaddresscom>' ); foreach $temp (@test){ if ($temp =~ /\<([.-A-Za-z]+\@[.-A-Za-z]+\.[A-Za-z]{2,4}})\>/){ print "$1\n"; } else { print "$temp failed \n"; } }
    This will account for *many* of the common email address forms you will run into (using the formatting provided - there as many possible formats for an email address as there are ..umm.. email addresses). It doesn't account for lots of things, and as you can see, gives you a false positive for #5, but will get your list *real close*.

    Thanks again for the gentle reminder jeffa. Much appreciated.

    EEjack