in reply to Determine if domain is actually used for email

Email::Valid does this; for domains or as a part of validating addresses: "mx ( <ADDRESS>|<DOMAIN> ) This method accepts an email address or domain name and determines whether a DNS record (A or MX) exists for it."

perl -MEmail::Valid -le 'print Email::Valid->mx("gmail.com") ? "yep" : + "nope"' yep perl -MEmail::Valid -le 'print Email::Valid->mx("tacohut.co.uk.jp.cx") + ? "yep" : "nope"' nope

Replies are listed 'Best First'.
Re^2: Determine if domain is actually used for email
by Limbic~Region (Chancellor) on Oct 04, 2011 at 18:19 UTC
    Your Mother,
    Except that vit indicated in the original post that the presence of an MX record is not a reliable source of the domain's ability to receive email. Apparently DNS administrators are registering MX records all willy nilly.

    Cheers - L~R

      Sure... but unless I'm misled, with UDP there simply is no way to know for sure excepting an out of band response—a visit to a tokenized URI sent in a message or a return message from the same domain/address. So no checks will be guaranteed. "Heroic" messages to circumvent misused standards / client-fail seems a mistake.

        Your Mother,
        I have no idea where UDP came into the conversation since SMTP is a TCP protocol. I agree that there is no way to be sure unless you can deliver mail to a recipient and get a DSN or, preferred, a response. Seeing if the server is listening on port 25 and is responding in a manner consistent with a SMTP server and not giving a 521 status code is a pretty safe bet though.

        Cheers - L~R