micke / valid_email2

ActiveModel validation for email. Including MX lookup and disposable email blacklist
MIT License
620 stars 99 forks source link

Add support for NullMX #206

Closed bb closed 10 months ago

bb commented 10 months ago

Please add support for NullMX as defined in https://datatracker.ietf.org/doc/html/rfc7505

TLDR: Domains without an MX record but with an A record want to receive mails via A record. This is already implemented with the "strict" option. If a domain owner really does not want to receive mails, they need to specify a null MX record. A null MX is specified as preference number 0 and a zero length label, written in master files as .

Example Domain with this configuration: gmail.de

> dig gmail.de
gmail.de.       300 IN  A   142.250.185.229

> dig mx gmail.de
gmail.de.       116 IN  MX  0 .

Expectation

Both in strict mode and non-strict mode:

User.new(email: "anything@gmail.de").valid? # => false

Observation

gmail.de is valid in non-strict mode. (I didn't test strict.)

micke commented 10 months ago

Ah, i didn't know there was a specific nullmx version of the implicit MX server, but of course there is!

Pull requests are greatly appreciated!

bb commented 10 months ago

See #207. Feedback welcome 😊

micke commented 10 months ago

I've released version 5.0.0.

Thank you so much for your contribution!

bb commented 10 months ago

Thanks for the quick responses ⚡ and for the new release 🚀 . I already updated and now wait for CI.