• Jesus_666@feddit.de
    link
    fedilink
    arrow-up
    0
    ·
    9 months ago

    You can use a regex to do basic validation. That regex is .+@.+. Anything beyond that is a waste of time.

    • hansl@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      9 months ago

      There are also cases where you want to have a disallow list of known bad email providers. That’s also part of the parsing and validating.

      • Tramort@programming.dev
        link
        fedilink
        arrow-up
        0
        ·
        9 months ago

        It’s a valid need, but a domain blacklist isn’t part of email parsing and if you conflate the two inside your program then you’re mixing concerns.

        Why is the domain blacklist even in your program? It should be a user configurable file or a list of domains in the database.

        • Black616Angel@feddit.de
          link
          fedilink
          arrow-up
          0
          ·
          9 months ago

          You are right in that it isn’t (or shouldn’t be) part of the parsing, but the program has to check the blacklist even if it’s in a database.

      • Jesus_666@feddit.de
        link
        fedilink
        arrow-up
        0
        ·
        9 months ago

        Which ones? In RFC 5322 every address contains an addr-spec at some point, which in turn must include an @. RFC 6854 does not seem to change this. Or did I misread something?

          • Jesus_666@feddit.de
            link
            fedilink
            arrow-up
            0
            ·
            edit-2
            9 months ago

            And it’s matched by .+@.+ as it contains an @.

            Remember, we’re taking about regular expressions here so .+ means “a sequence of one or more arbitrary characters”. It does not imply that an actual dot is present.

            (And I overlooked the edit. Oops.)