knuppn has asked for the wisdom of the Perl Monks concerning the following question:
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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Verifying Email Addresses
by choroba (Cardinal) on Apr 04, 2019 at 15:04 UTC | |
|
Re: Verifying Email Addresses
by AnomalousMonk (Archbishop) on Apr 04, 2019 at 17:25 UTC | |
by knuppn (Initiate) on Apr 04, 2019 at 19:17 UTC | |
by AnomalousMonk (Archbishop) on Apr 04, 2019 at 20:29 UTC | |
|
Re: Verifying Email Addresses
by thanos1983 (Parson) on Apr 04, 2019 at 15:25 UTC |