I also reached out to them on Twitter but they directed me to this form. I followed up with them on Twitter with what happened in this screenshot but they are now ignoring me.
I also reached out to them on Twitter but they directed me to this form. I followed up with them on Twitter with what happened in this screenshot but they are now ignoring me.
I’m not aware of any correct email validations. I’m still looking for something accepting a space in the localpart.
Also a surprising number of sites mess with the casing of the localpart. Don’t do that - many mailservers do accept arbitrary case, but not all. MyName@example.com and myname@example.com are two different mail addresses, which may point to the same mailbox if you are lucky.
The only correct regex for email is:
.+@.+
So long as the address has a local part, the at sign, and a hostname, it’s a valid email address.
Whether it goes somewhere is the tricky part.
Sorry, this is not a correct regex for an email address.
Sending using
mail
on a local unix system? You only need the local part.STOP VALIDATING NAMES AND EMAIL ADDRESSES. Send a verification email. Full stop. Don’t do anything else. You really want to do this anyway, because it’s a defense against bots.
*Gasp* the registration is coming from inside the colo!
I think it’s fair to prevent users from causing mail sent to your internal systems. It probably won’t cause any issues getting mail to the machine inbox for (no domain name), but it reasonably makes security uneasy.
The statement I was responding to was “This is the correct email regex”. There is no correct email regex. Don’t parse emails with a regex. You probably don’t need to parse emails at all.
Yes, but no. Pretty much every application that accepts an email address on a form is going to turn around and make an API call to send that email. Guess what that API is going to do when you send it a string for a recipient address without an @ sign? It’s going to refuse it with an error.
Therefore the correct amount of validation is that which satisfies whatever format the underlying API requires.
For example, AWS SES requires addresses in the form UserName@[SubDomain.]Domain.TopLevelDomain along with other caveats. If the application is using SES to send emails, I’m not going to allow an input that doesn’t meet those requirements.
You mean the validation which the underlying API will perform on its own? You don’t need to do it.
Here’s my address: @@@@@
And this right here is a great example of why simple basic RegEx is rarely adequate
At the very least, should be something like
^[^@\s]+@([^@\s.]+\.)+[^@\s.]+$
I’m like 99% sure I missed at least a few cases there, and will say “please don’t use this for anything production”
Here’s two: you can have multiple @s forming relays in an email address, and you can also break all the rules around dots and spaces if you put quotes around the local part, eg ".sarah.."@emails.com
And this is exactly why I wouldn’t do my own, I had no idea either of those were legal/possible
To be fair nor do most email providers! It’s in the spec, though.
You should be able to double quote the local part and use the space. "like this"@email.net. Good luck getting that through a validator though.
There isn’t a perfect one afaik - this one is apparently the closest you can get (https://emailregex.com) (?:[a-z0-9!#$%&'+/=?^_
{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_
~-]+)|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\[\x01-\x09\x0b\x0c\x0e-\x7f])")@(?:(?:a-z0-9?.)+a-z0-9?|[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-][a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\[\x01-\x09\x0b\x0c\x0e-\x7f])+)])