Email validation MX Lookup

后端 未结 2 1017
后悔当初
后悔当初 2021-02-14 22:15

I have been asked to implement some email address validation on a web app - I\'m sure we\'ve all been there a thousand times... however, this time I have been asked to do an MX

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-14 22:46

    are there any edge cases where a valid email address could fail an MX lookup check?

    Yes, in that where there is no MX record, MTAs fall back to using the A record instead. So only allowing MX records would fail a class of mail servers that work in the real world.

    Allowing any name with an MX or A record at least detects obvious mistypings that result in NXDOMAIN. However it will still allow mistypings that end up at squatter sites. A further step for addresses resolved by A records might be to check where port 25 is accepting connections on that address.

提交回复
热议问题