Code Monkey home page Code Monkey logo

Comments (13)

balexand avatar balexand commented on September 13, 2024 4

@karlwilbur Thanks for all of your contributions to this project over the years. I'm no longer developing in Ruby. I've been using Elixir for the past 2 years.

Do you have any interest in taking over the official email_validator gem?

from email_validator.

karlwilbur avatar karlwilbur commented on September 13, 2024 1

@balexand Sure. I'd be happy to.

I'll have to sort out how I am going to support your changes to accommodate David Gilbertson's validation philosophy. While I clearly disagree with that and prefer to have more standards-compliant validation, I respect that there are others who are far less concerned with that than I. As such I don't want to break their implementations and would like to provide them the same support that the community has provided me.

I'm available to work with you to transition this over to me in whichever way you see fit.

from email_validator.

kapcod avatar kapcod commented on September 13, 2024 1

@karlwilbur I suggest maybe providing various levels of validation.
E.g. just allow EmailValidator.method = :strict (with default to :loose)

In our case, we do need constantly up-to-date exact validator, so that we stop getting these errors from email provider saying that we're trying to send emails to invalid addresses. Somehow people just love to create emails like "user@gmail" without the ".com" and even thought "gmail" IS a valid domain by domain validator, it's not a valid address and gets rejected. Or addresses like "[email protected]" which turned out to also be invalid.

from email_validator.

estepnv avatar estepnv commented on September 13, 2024

also it accepts emojis. I looked at regex. is it really enough?

from email_validator.

schweigert avatar schweigert commented on September 13, 2024

The regex does not specify which characters can belong to an email. It just says it needs to be a character. Spaces and emojis fall in these cases :(

from email_validator.

karlwilbur avatar karlwilbur commented on September 13, 2024

The intent of the "loose" checking is just to confirm that there is an email-like string provided. The README makes this pretty clear.

I have a fork that maintains the earlier, more strict, validation:
https://github.com/karlwilbur/email_validator

from email_validator.

schweigert avatar schweigert commented on September 13, 2024

This is the most beautiful action that the open source community can see

from email_validator.

karlwilbur avatar karlwilbur commented on September 13, 2024

@kapcod Yep, that's sort of what I have in mind. You can see what I have over at https://github.com/karlwilbur/email_validator and I'll be trying to work those changes into a new release here within the next month or so. I had hoped to get to it sooner, but 2020 just been one of those years.

What I already have does this:

validates :my_email_attribute
validates :my_email_attribute, email: {strict_mode: true}
EmailValidator.valid?('[email protected]')
EmailValidator.valid?('[email protected]', {strict_mode: true})

Or you can enable via your Gemfile, as explained in the README, and also via an initializer with:

EmailValidator::default_options[:strict_mode] = true

However, in your case, user@gmail is technically valid per the RFC, which is how the strict_mode works. I think that, for you, we might want to add a :require_fqdn config option similar to what I am with the :domain option. Do you think that it would work for you if we adding something like this:

# per-model
validates :my_email_attribute, email: {require_fqdn: true}
# via initializer
EmailValidator::default_options[:require_fqdn] = true

I also want to include the ability to supply a custom regexp per-model or via an initializer, but haven't started on that yet.

from email_validator.

kapcod avatar kapcod commented on September 13, 2024

from email_validator.

karlwilbur avatar karlwilbur commented on September 13, 2024

@kapcod, Yes. Correct. This is because "aaa@gmail" is a valid email. Is the same way, "karl@karl-desktop" is a valid email address (I successfully use karl@karl-desktop many times a day). This is per the email standards and are valid emails.

You are looking for something more than just a valid email address. You want to also require a FQDN. Do you think that my suggestion (adding a require_fqdn option) would work for you?

from email_validator.

karlwilbur avatar karlwilbur commented on September 13, 2024

@kapcod, I added that require_fqdn option and enabled it by default. You can check it out here:
https://github.com/karlwilbur/email_validator/commit/a7ec186e29c503231580729066ffa98d7d611d8b

Let me know if you think that would work for your situation.

from email_validator.

karlwilbur avatar karlwilbur commented on September 13, 2024

@kapcod The require_fqdn option was added in v2.1.0. I am closing this issue.

from email_validator.

karlwilbur avatar karlwilbur commented on September 13, 2024

Just to be clear, the :require_fqdn option is not enabled by default in the actual release. It can be enabled as detailed in the README. When :strict mode is enabled (using mode: :strict, strict_mode: true is no longer supported), the :require_fqdn is also enabled.

from email_validator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.