Perl-Email-Project / Email-Valid

perl library to validate email addresses
19 stars 19 forks source link

Strict -mx checking? #59

Open pjwelsh opened 10 months ago

pjwelsh commented 10 months ago

I'm struggling to figure out how have Email::Valid require both a valid domain and valid MX record, but not succeeding. For example, the domain "renptr.com" produces positive results as a valid domain, but does not produce positive results for basic system tool MX check:

$ host renptr.com
renptr.com has address x.x.x.x
$ host -t mx renptr.com
renptr.com has no MX record

However, Email::Valid seems to insist the -mx or -mxcheck checks are "valid" when it should not:

$ perl -mEmail::Valid -E "say Email::Valid->address( -address => 'fred@renptr.com', -mxcheck => 1 ) ? 'is valid' : 'not valid'"
is valid

How to make the "A" and "MX" and "AND" operation or is this a bug (or am I not running Email::Valid correctly)?

I did see the changelog note about adding the "A" check back to the MX check option and the open ticket #51 for the null MX record, but even making the mentioned code change did not help.