I am trying to verify all the E-mail addresses in my database without sending any actual e-mails. I'm using Email::Verify::SMTP, which seems to work, except that it reports EVERY e-mail address as invalid. Below is the actual subroutine (validate_EMAIL) preceded by some pseudo code showing how I invoke the subroutine.

The $EMAIL_ADDRESS field of each $MEMBER_rec will contain at least one address and may contain multiple addresses delimited by a semicolon. The subroutine will break this scalar into individual addresses and validate each one separately, then report the whole block back to the main section.

The original author is no longer reachable via e-mail, so I'm looking for help from anyone who has had success with this package.

## psuedo code: use Email::Verify::SMTP; $f3 = "font size=3"; $f0 = "/font"; foreach $MEMBER_rec (@MEMBER_data) { (undef,$EMAIL_ADDRESS,undef, ...) = splip(/\|/,$MEMBER_rec); &validate_EMAIL; print STDOUT "$EMAIL_ADDRESS\n"; } exit; sub validate_EMAIL { # This is important: $Email::Verify::SMTP::FROM = 'webmaster@$hostnm'; $return_EMAIL = ""; $tmp_EMAIL = $EMAIL_ADDRESS; $tmp_EMAIL =~ s/\s//g; # Get rid of any whitespace. @tmp_EMAIL = split(/;/,$tmp_EMAIL); foreach $tmp_EMAIL_lc (@tmp_EMAIL) { $tmp_EMAIL_lc =~ tr/A-Z/a-z/; # Find out if, and why not (if not): my ($is_valid, $msg) = verify_email('$tmp_EMAIL_lc'); if( $is_valid ) # Email is valid: $return_EMAIL .= "; <$f3>$tmp_EMAIL_lc<$f0>"; } else { # Email is *not* valid: $return_EMAIL .= "; <$f3 color=RED>$tmp_EMAIL_lc<$f0>"; } } $return_EMAIL =~ s/^; //; $return_EMAIL =~ s/; /<br>/g; $EMAIL_ADDRESS = $return_EMAIL; }

In reply to Verifying Email Addresses by knuppn

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.