Does Email Validation Mx Fallback To A Record?

Just wondering if the email validation option checkMX when used in conjunction with checkPort falls back to using the main A record for the domain to check if port 25 is open?

Does it just fail when there is no MX record and does not even bother checking the port?

I know this sounds strange but I was reading on stack overflow that some MTAs are configured to try the A record if no MX record exists for the domain.

(won’t let me post links so just imagine this has a preceding h t t p :P )

In my 10+ years of server admin I have not seen this behavior from an MTA but must admit I didn’t know it was even done. As far as I understood it MX records are what are checked by the MTA “out of the box”.

Could anyone say for certain that this practice is still a common place? To configure your MTA to use the A record if no MX exists?

Cheers,

Geoff T

Yii’s email validator used to check for port 25 of the fqdn right away until v1.1.11. What changed then was that code has been set in place that would fetch all MX records, sort them by priority and see if their port 25 has been opened. There is no fallback to any A records if that check fails.

Well, I went through quite a number of MTA installations and never observed this behaviour. Then again, I wasn’t actively looking for it.

You can always send an email to e.g. "mike@mytesthost.example.com", even if there is no MX record for this domain. And from an MTA perspective there’s no difference between a second level and third level domain (“example.com” is treatet the same as “xyz.example.com”). So I’d say, that the fallback to A record is standard. I can’t point you to the RFC, where this is defined though.

I’d say that were only the case iff there is either an a-level record for xyz.example.com or a wildcard record for *.example.com. In all other cases, resolving xyz.example.com should fail.

Back to the original issue: If this is really a common approach, we should patch CEmailValidator. If someone could point out an RFC => all the better!

Of course there must be an A- or CNAME- or wildcard record for that host - how else would the sender resolve it? But the question was, if a MX is required. It’s not.

Yeah that was my main question. So to make sure I am clear on this… a domain with no MX record set will still be checked by checkMX and checkPort options, it will just use the A record for the root domain? That is how it is working now?

Here’s what these options do in regard to MX records:

  • checkMX : Checks, if there’s a MX record for the given domain/hostname in DNS.

  • checkPort: First fetches the MX record (not A record!) from DNS and then checks, if the SMTP port 25 of that IP address is reachable.

So both options require a MX record in DNS for any given email domain. [size=“2”]Given what i said above, an email may still be deliverable, even if there is no MX record. So i’d be careful with these options. In fact, i personally never use them.[/size]

Thanks Mike