I say a few threads and put together some code as you can see below. I want to be able to determine if an address is valid: both the domain and account name. I don't really care if one or the other is valid, if either is invalid, then I consider the address to be invalid.

The code below is not very good, dispite several hours of work. eee@eee.com is ok. It does fail on addresses where there is no valid domain, but my code does not determine if the user account is valid. Before I continue to rack my brains, can I actually determine if a given email address is valid? Can Email::Valid or any other module actually call the mx daemon at ee.com to see if the given account, eee, is valid?

I continue to look, but am beginning to realise the best way is to talk directly to the smtp port directly, but I fear the code could develope into a nightmare...I sense this is really easy and I am just missing the point. Can someone hit me with a 2x4?

Please advise,

Simon

if($EmailAddress) { eval { if (my $addr = Email::Valid->address( -address => $EmailAd +dress, function start() { document.forms[0].elements[0].focus(); } </SCRIPT> </HEAD> <body bgcolor='ffffcc' onLoad='start()'> "; generate_form(); my $EmailAddress = $cgi->param('EmailAddress'); if($EmailAddress) { eval { if (my $addr = Email::Valid->address( -address => $EmailAd +dress, -mxcheck => 1, -fudge => 1 )) { print "$addr OK\n"; } else { print "$addr failed $Email::Valid::Details check.\n"; } }; warn "an error was encountered: $@" if $@; } print end_html();

In reply to Determining a valid address by sdyates

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.