Re: Email Verfication Regular Expression

From: merlyn(at)stonehenge(dot)com (Randal L(dot) Schwartz)
To: "Cristian Prieto" <cristian(at)clickdiario(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Email Verfication Regular Expression
Date: 2005-09-08 19:31:08
Message-ID: 86br33mk5f.fsf@blue.stonehenge.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>>>>> "Cristian" == Cristian Prieto <cristian(at)clickdiario(dot)com> writes:

Cristian> res = res_query(name, C_IN, T_MX, answer, sizeof(answer));

This incorrectly fails if an address has an "A" record but no "MX"
record. According to RFC 2821 Section 5:

The lookup first attempts to locate an MX record associated with
the name. If a CNAME record is found instead, the resulting name
is processed as if it were the initial name. If no MX records are
found, but an A RR is found, the A RR is treated as if it was
associated with an implicit MX RR, with a preference of 0, pointing
to that host.

So, your function will say "no good" if the domain has an A record but
no MX record, even though the RFC says that's OK and deliverable.

Man, is there a lot of bogus knowledge and cargo culting around this
subject!

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn(at)stonehenge(dot)com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message snacktime 2005-09-08 19:37:24 per user logging
Previous Message Michael Schmidt 2005-09-08 19:08:22 Re: EMS PostgreSQL Manager vs. TheKompany DataArchitect