Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

email adresses ending with dot bug fixed #465

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ func SetNilPtrAllowedByRequired(value bool) {
// IsEmail checks if the string is an email.
func IsEmail(str string) bool {
// TODO uppercase letters are not supported
return rxEmail.MatchString(str)
_, err := str.ParseAddress(str)
return err == nil
}

// IsExistingEmail checks if the string is an email of existing domain
Expand Down
1 change: 1 addition & 0 deletions validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,7 @@ func TestIsEmail(t *testing.T) {
{"foo@bar.中文网", true},
{"invalidemail@", false},
{"invalid.com", false},
{"invalid.", false},
{"@invalid.com", false},
{"test|123@m端ller.com", true},
{"hans@m端ller.com", true},
Expand Down