{"action":"created","issue":{"url":"https://api.github.com/repos/Perl-Email-Project/Email-Valid/issues/18","repository_url":"https://api.github.com/repos/Perl-Email-Project/Email-Valid","labels_url":"https://api.github.com/repos/Perl-Email-Project/Email-Valid/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/Perl-Email-Project/Email-Valid/issues/18/comments","events_url":"https://api.github.com/repos/Perl-Email-Project/Email-Valid/issues/18/events","html_url":"https://github.com/Perl-Email-Project/Email-Valid/pull/18","id":95104825,"number":18,"title":"Improved Net::DNS MX Record Checking","user":{"login":"tmorehouse","id":2781561,"avatar_url":"https://avatars.githubusercontent.com/u/2781561?v=3","gravatar_id":"","url":"https://api.github.com/users/tmorehouse","html_url":"https://github.com/tmorehouse","followers_url":"https://api.github.com/users/tmorehouse/followers","following_url":"https://api.github.com/users/tmorehouse/following{/other_user}","gists_url":"https://api.github.com/users/tmorehouse/gists{/gist_id}","starred_url":"https://api.github.com/users/tmorehouse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmorehouse/subscriptions","organizations_url":"https://api.github.com/users/tmorehouse/orgs","repos_url":"https://api.github.com/users/tmorehouse/repos","events_url":"https://api.github.com/users/tmorehouse/events{/privacy}","received_events_url":"https://api.github.com/users/tmorehouse/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2015-07-15T04:39:45Z","updated_at":"2016-09-20T04:41:49Z","closed_at":"2015-10-17T02:22:17Z","pull_request":{"url":"https://api.github.com/repos/Perl-Email-Project/Email-Valid/pulls/18","html_url":"https://github.com/Perl-Email-Project/Email-Valid/pull/18","diff_url":"https://github.com/Perl-Email-Project/Email-Valid/pull/18.diff","patch_url":"https://github.com/Perl-Email-Project/Email-Valid/pull/18.patch"},"body":"For some domains (specifically one of my own I was testing against), the mxcheck routine was returning a false positive (pass) when it should have failed the test (i.e. no MX records in the DNS).\r\n\r\nThis shortened routine appears to get around that issue."},"comment":{"url":"https://api.github.com/repos/Perl-Email-Project/Email-Valid/issues/comments/248199924","html_url":"https://github.com/Perl-Email-Project/Email-Valid/pull/18#issuecomment-248199924","issue_url":"https://api.github.com/repos/Perl-Email-Project/Email-Valid/issues/18","id":248199924,"user":{"login":"tmorehouse","id":2781561,"avatar_url":"https://avatars.githubusercontent.com/u/2781561?v=3","gravatar_id":"","url":"https://api.github.com/users/tmorehouse","html_url":"https://github.com/tmorehouse","followers_url":"https://api.github.com/users/tmorehouse/followers","following_url":"https://api.github.com/users/tmorehouse/following{/other_user}","gists_url":"https://api.github.com/users/tmorehouse/gists{/gist_id}","starred_url":"https://api.github.com/users/tmorehouse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmorehouse/subscriptions","organizations_url":"https://api.github.com/users/tmorehouse/orgs","repos_url":"https://api.github.com/users/tmorehouse/repos","events_url":"https://api.github.com/users/tmorehouse/events{/privacy}","received_events_url":"https://api.github.com/users/tmorehouse/received_events","type":"User","site_admin":false},"created_at":"2016-09-20T04:41:49Z","updated_at":"2016-09-20T04:41:49Z","body":"If one does want to check for an A record if no MX's are found, one could modify the `_net_dns_query` function as so:\r\n\r\n~~~~~~~~\r\nsub _net_dns_query {\r\n  my $self = shift;\r\n  my $host = shift;\r\n\r\n  $Resolver = Net::DNS::Resolver->new unless defined $Resolver;\r\n\r\n  # Check for valid MX entries\r\n  my @mx_entries = Net::DNS::mx($Resolver, $host);\r\n  if (@mx_entries) {\r\n    foreach my $mx (@mx_entries) {\r\n      my $mxhost = $mx->exchange;\r\n      my $query  = $Resolver->search($mxhost);\r\n      next unless ($query);\r\n      foreach my $a_rr ($query->answer) {\r\n        return 1 unless $a_rr->type ne 'A';\r\n      }\r\n    }\r\n  }\r\n  \r\n  # Check for valid $host A records\r\n  my @a_rrs = Net::DNS::rr(Resolver, $host, 'A');\r\n  if (@a_rrs) {\r\n    foreach my $a_rr (@a_rrs) {\r\n      return 1 unless $a_rr->type ne 'A';\r\n    }\r\n  }\r\n  \r\n # Else fail MX Check  \r\n  return $self->details('mx');\r\n}\r\n~~~~~~~~"}}
{"actor":{"display_login":"tmorehouse"}}