[UPHPU] MX Records reliable
cole at colejoplin.com
cole at colejoplin.com
Tue Apr 10 22:06:55 MDT 2007
Quoting Lonnie Olson <lists at kittypee.com>:
> Daniel wrote:
>> I have a form where people can submit feedback to the webmaster. I
>> want to make sure I can reply to the patron. Would I get most of my
>> patrons verified if I check for an MX Record for the email address
>> they provide?
>
> Checking DNS records for email validation is generally not a good idea.
> It can often be slow. I only recommend it's use in situations where
> the email's validation is highly critical. And even then it isn't
> always the best way to validate.
>
> Possible email validation steps:
> * Regex to validate address conforms to a legal format.
> * Use dns_get_record to get any MX and/or A records for a domain
> * Connect to their mail host (MX preferred, or A) to ensure connections
> are accepted.
> * Send a test/bogus message to them to verify user exists, and cancel
> send before any actual DATA.
> * Send a real test message to them, check for bounce messages.
> * Wait for confirmation URL to be clicked.
>
> As you can see these steps have increasing failure rates and
> complexity. Many are prone to false positives, and false negatives.
>
> My general recommendation is that only the regex is necessary for most
> validation. Simple send a confirmation URL and wait for it to be
> registered can be used for very highly critical email validation.
> Anything in between is too prone for error, confusion, performance, and
> failure.
>
> --lonnie
Unfortunately, not enough webmasters are using MX records, so I don't
recommend it. Neither do I recommend a domain check. I suggest a quick
SMTP check. You can use PHP to send SMTP commands like:
HELO local.domain.name
which will verify or deny that the address either 1) will accept
emails or 2) exists at all. Works just like a ping. You would then
look for a response like:
250 mail.domain.ext Hello local.domain.name
There are a number of PHP classes available for you.
-- Cole
More information about the UPHPU
mailing list