4 ms·
Can't test the product they try to promote because emails with a `+` in them are not valid.
by Mashimo 9y ago
Can't test the product they try to promote because emails with a `+` in them are not valid.
- ScottBurson 9y ago> emails with a `+` in them are not valid Wrong: https://en.wikipedia.org/wiki/Email_address#Syntax https://en.wikipedia.org/wiki/Email_address#Syntax (I know this is of little help if your email app doesn't allow them. I just want to point out that the standard does allow them.)
- coldacid 9y agoI think what Mashimo means is that Infoteam.ch thinks that `+` is invalid when it isn't. Sadly they're far from the only ones whose email validation code won't accept the plus character, or many other legal characters in the local part of an email address.
- codetrotter 9y agoEmail validation regexes are so annoying. Everyone ought to just use .+@.+ as their validation regex and not be more strict than that. Beyond that just queue and try to deliver the email. Tell the user than an email should arrive shortly and that if it doesn’t they should check their spam folder and that they should check that they gave the correct email address. When you say this you repeat the email address that the user gave you (escaped for XSS of course). I think some people “validate” against a strict pattern to keep their users from mistyping, but really there are so many ways to make a typo and still match those regexes that IMO it’s pointless to use a complicated regex and 80% of the times those regexes end up rejecting actually valid (though unusual) email addresses. I think for a lot of developers the reason they do this is that they’ve learned that they should validate data and so they decide to validate email and to do so they either copy-paste some random-ass regex off the internet or they write their own broken regexes. All your regex should do is to ensure that there is an @ in the address and that there is something before and something after. This keeps people from mistakenly entering say for example their phone number because they didn’t read what the field was for. To prevent people from making your machine send your emails where it should not, such as to root@localhost of your server or elsewhere on your local network (don’t know why anyone would and also it wouldn’t be a big issue, just a tiny bit annoying), is a server configuration concern. Specifically, a concern of configuration of the email server software and of your firewalls. User presses sign up -> Send then to registration form, they fill in their details which you validate lightly client side, they submit -> You validate lightly server-side and either send them back to the form or on to the next step -> You tell them “Thank you, your registration is now complete. An email should arrive in your inbox shortly. If it does not, please check your spam folder and also control that you entered your email address correctly. The email address you gave us was somebody@example.com.”
- theandrewbailey 9y agoSorry, but .+@.+ isn't going to cut it if you want to confidently accept deliverable email addresses. Regex valid, but not email valid: codetrotter@example code@trotter@example.com code trotter@example.com codetrotter@example..com codetrotter@example.com. .codetrotter@example.com My company runs a website that has elderly people signing up for newsletters. The client is paranoid about not getting every last drop of possible data, and raises hell for every email address that isn't deliverable. There are LOTS of ways to easily ruin a simple email address.
- Domenic_S 9y agoAn email address being syntactically valid is no guarantee that the mailbox even exists or is correctly mapped to the person at the keyboard!
- deleted 9y ago[deleted]
- plopz 9y agocodetrotter@example is a valid email
- theandrewbailey 9y agoI should have been more specific: an email address that is routable over the internet. Where's the TLD on that?
- deathanatos 9y agoWhat section of what standard says a TLD can't have an email server on it? Is AAA not allowed to host an email server on `aaa`[1], and have the email `sales@aaa`? [1]: And "aaa" is a valid TLD; see the full list: https://www.iana.org/domains/root/db https://www.iana.org/domains/root/db ; now, perhaps it is required to at least have a second level domain, but that's what I'm asking: is an MX record invalid on a TLD?