There are basically three levels of address checking: 1) You need to validate an email field for login or a website - checking for an @ mark with some text before and at least one . after the @ will do for this. 2) You need to do some sort of address validation, library regexps like this will do for 99.9...% of these. 3) You are building an email handling system which needs to actually support the RFCs, in which case…
> at least one . after the @ will do for this technically not required... [adam@solomon]$ dig +noall +answer mx ai ai. 21572 IN MX 10 mail.offshore.ai.
Ruby's Email Address Regexp
41–50 of 69 posts
Re: Ruby's Email Address Regexp
#42There are basically three levels of address checking: 1) You need to validate an email field for login or a website - checking for an @ mark with some text before and at least one . after the @ will do for this. 2) You need to do some sort of address validation, library regexps like this will do for 99.9...% of these. 3) You are building an email handling system which needs to actually support the RFCs, in which case…
> at least one . after the @ will do for this technically not required... [adam@solomon]$ dig +noall +answer mx ai ai. 21572 IN MX 10 mail.offshore.ai.
In my opinion, the optimal validation is soft validation: "your email address doesn't look right, continue with it?"
Re: Ruby's Email Address Regexp
#43There are basically three levels of address checking: 1) You need to validate an email field for login or a website - checking for an @ mark with some text before and at least one . after the @ will do for this. 2) You need to do some sort of address validation, library regexps like this will do for 99.9...% of these. 3) You are building an email handling system which needs to actually support the RFCs, in which case…
Level 4: You need an address backed by an actually valid mailbox. At which point you need to send an email to the address to validate.
Re: Ruby's Email Address Regexp
#44Earlier quoted context omitted.
Never mind the regex, `email.indexOf("@") > 2` does the trick and faster if you happen to need to check many emails. All websites these days require verification of emails (regardless of whether or not it's necessary), and if that's not enough validation, I don't know what is!
Why 2? Greater than 0, sure.
Off by one errors are about half of working with arrays.
Re: Ruby's Email Address Regexp
#45SMTP had a very useful VRFY command after you've tested for the @ and MX record, but only a handful of service providers will tell you if the email is invalid nowadays due to spam concerns. Gmail still does though, which is a big deal as 90% of people who register on my sites are using a gmail address only and thus easy to verify instantly and notify the user to double check the email spelling.
Re: Ruby's Email Address Regexp
#46There are basically three levels of address checking: 1) You need to validate an email field for login or a website - checking for an @ mark with some text before and at least one . after the @ will do for this. 2) You need to do some sort of address validation, library regexps like this will do for 99.9...% of these. 3) You are building an email handling system which needs to actually support the RFCs, in which case…
Re: Ruby's Email Address Regexp
#47Re: Ruby's Email Address Regexp
#48https://fightingforalostcause.net/content/misc/2006/compare-...
Re: Ruby's Email Address Regexp
#49Earlier quoted context omitted.
Level 4: You need an address backed by an actually valid mailbox. At which point you need to send an email to the address to validate.
At which point, why even bother with 1, 2, and 3? Just try to send it.
Re: Ruby's Email Address Regexp
#50I have a .email domain that at least one major site rejects as invalid. Quite annoying.