| ▲ | dfabulich 3 hours ago | |
Don't forget RFC 5321! But the RFCs are ignored in practice by all popular mail servers. There are email addresses that work in practice that don't comply with the RFCs, and there are email addresses that the RFCs permit that don't work in practice. (This happens with a lot of standards; sometimes people just ignore them and do their own thing. Something similar has happened with SVGs.) If you write a formal verification of a syntactical email validator that ensures that all/only RFC-compliant email addresses are valid, you'll have completely wasted your time. Don't do it. Just check for at least one @ sign, and email the address to test it. (This is a perfect example of the trap of formal verification.) | ||
| ▲ | win311fwg 2 hours ago | parent [-] | |
> Don't forget RFC 5321! As long as you don't forget RFC 6531. > But the RFCs are ignored in practice by all popular mail servers. While I agree that you can make a compelling case that sending email is the C in CRUD, usually when someone is talking about CRUD they are referring to systems that satisfy all four letters. U violates the spirit of email, and R and D is usually handled independently of the MTA. So what email servers do here is irrelevant. If you go way back up the comment chain you will even see that Postgres was specifically mentioned. Postgres doesn't care what an email server does, but it does care about data consistency. > Just check for at least one @ sign That's a valid specification and in practice you are going to want to make that a PBT to ensure that your implementation actually adheres to the specification. You might try testing foo@bar.com, but what about foo\u0040bar.com? Will you think to test it too? Probably not. Will your code handle it correctly? You may be perfect, but when we get out into the general developer population where all kinds of crazy things show up when they start monkeying with your code, the answer is also probably not. Looking simple isn’t a reason to not use the tools at your disposal, even if many won’t. > and email the address to test it. Poor general advice. That is expressly illegal in some jurisdictions. | ||