diff --git a/src/System Application/App/Email/src/Account/EmailAccountImpl.Codeunit.al b/src/System Application/App/Email/src/Account/EmailAccountImpl.Codeunit.al index 349d2029f7..bd9ede19d0 100644 --- a/src/System Application/App/Email/src/Account/EmailAccountImpl.Codeunit.al +++ b/src/System Application/App/Email/src/Account/EmailAccountImpl.Codeunit.al @@ -294,6 +294,14 @@ codeunit 8889 "Email Account Impl." ValidatedEmailAddress := EmailAddress; if not ConvertEmailAddress(ValidatedEmailAddress) then Error(InvalidEmailAddressErr, EmailAddress); + + // Check that there is a top domain + if StrPos(CopyStr(ValidatedEmailAddress, StrPos(ValidatedEmailAddress, '@') + 2), '.') = 0 then + Error(InvalidEmailAddressErr, EmailAddress); + + // Check that the top domain is at least 2 characters long + if (ValidatedEmailAddress[StrLen(ValidatedEmailAddress)] = '.') or (ValidatedEmailAddress[StrLen(ValidatedEmailAddress) - 1] = '.') then + Error(InvalidEmailAddressErr, EmailAddress); end; EmailAccount.OnAfterValidateEmailAddress(EmailAddress, AllowEmptyValue);