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


In reply to Re: (jeffa) Re: Re: Expressing myself by eejack
in thread Expressing myself by web-yogini

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.