Net::ValidMX

Net::ValidMX is a Perl module to use DNS and/or regular expressions to verify if an email address could be valid.
Download

Net::ValidMX Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Kevin A. McGrail
  • Publisher web site:
  • http://search.cpan.org/~kmcgrail/Net-validMX-2.2.0/lib/Net/validMX.pm

Net::ValidMX Tags


Net::ValidMX Description

Net::ValidMX is a Perl module to use DNS and/or regular expressions to verify if an email address could be valid. Net::ValidMX is a Perl module to use DNS and/or regular expressions to verify if an email address could be valid.SYNOPSISNet::ValidMX - I wanted the ability to use DNS to verify if an email address COULD be valid by checking for valid MX records. This could be used for sender verification for emails with a program such as MIMEDefang or for websites to verify email addresses prior to registering users and/or sending a confirmation email.EXAMPLEThe distribution contains an example program to demonstrate working functionality as well to utilize as a command line interface to query one or more email addresses.Run the program with the space-seperated email addresses to test as your arguments: perl example/check_email_and_mx.pl kevin.mcgrail@thoughtworthy.com or perl example/check_email_and_mx.pl kevin.mcgrail@thoughtworthy.com google@google.com president@whitehouse.govIf you supply only one email address argument, the program will exit with a exit status of 0 for a success and 1 for a failure: perl example/check_email_and_mx.pl kevin.mcgrail@failed || echo 'This email is no good' MIMEDEFANGWe are using this routine with MIMEDefang and have been for many months via the filter_sender hooks. For example, make a function that excludes authorized senders for your particular setup and add the following code snippets to your mimedefang-filter:sub filter_initialize { #for Check Valid MX use Net::validMX qw(check_valid_mx); }sub is_authorized_sender { my ($sender, $RelayAddr) = @_; if () { return 1; } else { return 0; }}sub filter_sender { my ($sender, $ip, $hostname, $helo) = @_; my ($rv, $reason); #md_syslog('warning', "Testing $sender, $ip, $hostname, $helo"); if (&is_authorized_sender($sender, $RelayAddr)) { return ('CONTINUE', "ok"); } if ($sender ne '') { ($rv, $reason) = &check_valid_mx($sender); unless ($rv) { md_syslog('warning', "Rejecting $sender - Invalid MX: $reason."); return ('REJECT', "Sorry; $sender has an invalid MX record: $reason."); } }} Requirements: · DNS · Perl


Net::ValidMX Related Software