Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Email-Valid CPAN distribution.

Report information
The Basics
Id: 23723
Status: resolved
Priority: 0/
Queue: Email-Valid

People
Owner: Nobody in particular
Requestors: saj_cpan [...] thecommune.net
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Support Null MX
It would be nice if an mx check would return false when the domain has a null mx. For example, yhaoo.com. I am including a patch with test although I only implemented it for the Net::DNS resolver. See: http://ietfreport.isoc.org/idref/draft-delany-nullmx/
Subject: Email-Valid-nullmx.patch
diff -ur Email-Valid-0.179/lib/Email/Valid.pm Email-Valid-nullmx/lib/Email/Valid.pm --- Email-Valid-0.179/lib/Email/Valid.pm 2006-11-27 08:03:21.000000000 -0600 +++ Email-Valid-nullmx/lib/Email/Valid.pm 2006-11-29 17:17:24.000000000 -0600 @@ -124,10 +124,17 @@ $Resolver = Net::DNS::Resolver->new unless defined $Resolver; - my $packet = $Resolver->send($host, 'A') or croak $Resolver->errorstring; - return 1 if $packet->header->ancount; + my $packet = $Resolver->send($host, 'MX') or croak $Resolver->errorstring; + if ($packet->header->ancount) { + if ( ($packet->answer)[0]->exchange eq '' ) { + # Null MX + return 0; + } else { + return 1; + } + } - $packet = $Resolver->send($host, 'MX') or croak $Resolver->errorstring; + $packet = $Resolver->send($host, 'A') or croak $Resolver->errorstring; return 1 if $packet->header->ancount; return $self->details('mx'); Only in Email-Valid-nullmx/: Makefile.old diff -ur Email-Valid-0.179/t/valid.t Email-Valid-nullmx/t/valid.t --- Email-Valid-0.179/t/valid.t 2006-11-27 08:04:05.000000000 -0600 +++ Email-Valid-nullmx/t/valid.t 2006-11-29 17:22:20.000000000 -0600 @@ -1,7 +1,7 @@ #!perl use strict; -use Test::More tests => 21; +use Test::More tests => 22; BEGIN { use_ok('Email::Valid'); @@ -97,6 +97,11 @@ !$v->address(-address => 'blort@will-never-exist.pobox.com', -mxcheck => 1), 'blort@will-never-exist.pobox.com, with mxcheck, is invalid', ); + + ok( + !$v->address(-address => 'blort@yhaoo.com', -mxcheck => 1), + 'yhaoo.com has a null mx record', + ); } SKIP: {
Thanks, applied in git, with some minor changes. -- rjbs