From 007a0a224e49f866cf9f58040c38b6b90175b2f9 Mon Sep 17 00:00:00 2001 From: Kang Ming Date: Sat, 5 Oct 2024 10:39:33 -0700 Subject: [PATCH] fix: validateEmail should normalise emails --- internal/api/mail.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/api/mail.go b/internal/api/mail.go index 44f364453..696510862 100644 --- a/internal/api/mail.go +++ b/internal/api/mail.go @@ -2,6 +2,7 @@ package api import ( "net/http" + "strings" "time" "github.com/didip/tollbooth/v5" @@ -559,7 +560,7 @@ func (a *API) validateEmail(email string) (string, error) { return "", badRequestError(ErrorCodeValidationFailed, "Unable to validate email address: "+err.Error()) } - return email, nil + return strings.ToLower(email), nil } func validateSentWithinFrequencyLimit(sentAt *time.Time, frequency time.Duration) error {