skeggse/isemail

Add support for tldBlackList

Closed this issue · 5 comments

vdust commented

In the same way there is an option tldWhiteList, it would be nice to also have tldBlackList. A usecase for this is to forbid the use of user@localhost on production servers (which may have a valid MX record, so a dns check isn't enough), while still accepting any other user@tld that may be a valid public email address

Sounds like a good idea to me. I can take a stab at this in a few hours. One comment, though - the localhost entry should be in the hosts file, and isemail sends an actual dns request (thus bypassing host caching and config), so you shouldn't be seeing this...

vdust commented

Actually, even though localhost does appear in the hosts file, the name server on the concerned host (which is the one set in resolv.conf) also has a zone file for localhost that contains an A record, but also an MX record. So the dns check does hit it and returns a valid MX record for localhost.

I'm actually waiting on outmoded/hapi-contrib#62 before moving forward on this.

All done!

@vdust keep in mind that a@[127.0.0.1] is valid for SMTP, so it might make sense to set errorLevel to 7 (dnsWarn) to avoid such an address being treated as valid.