ValidateEmail validates the email address using WHATWG HTML spec. Only lowercase ASCII letters, digits, and standard email symbols are allowed.
(email string)
| 165 | // ValidateEmail validates the email address using WHATWG HTML spec. |
| 166 | // Only lowercase ASCII letters, digits, and standard email symbols are allowed. |
| 167 | func ValidateEmail(email string) error { |
| 168 | if !emailRegex.MatchString(email) { |
| 169 | return errors.New("invalid email address") |
| 170 | } |
| 171 | return nil |
| 172 | } |
| 173 | |
| 174 | // IsValidEmail returns true if the email is valid per WHATWG HTML spec. |
| 175 | func IsValidEmail(email string) bool { |
no outgoing calls
no test coverage detected