Action EmailAddressValidate

Action EmailAddressValidate

Hy everyone,

I found an issue working with the email validate action EmailAddressValidate(), that the platform provides, and i noticed that when you pass an empty email into this action, the action will return valid for the email! Is this suppose to happen ?


On this image you can see that for a simple valid email "" the outcome is valid, has for an empty string that is presented on the row below its also valid!
I don't know the specific regex behind this particular method, so this is somewhat an educated guess.
It is probably valid behaviour, because one can tune the empty-behaviour with the mandatory attribute of an entity.

as long as we dont know the regex behind it one cannot trust that specific function.
I bet there are more invalid emails which are valid for that method.

Hi Gonçalo

That method actually accepts a bit more than that.
If you check the documentation here, it also accepts addresses created with EmailAddressCreate as well as EmailAddressConcatenate.
This means that things like "User Name <>" (and lists of multiple addresses separated with ";") are also accepted.
The main objective of that built-in is to check if that address can be used on a "To", "Cc" or "Bcc" email field or passed to another EmailAddressConcatenate call.

So the empty is valid since it validates all those conditions.
If you want to make sure it is not empty you need to add an extra explicit condition.

João Rosado
Is there more documentation on the rules for validating the EmailAddress?

No, that i know off.

But there should be more information on how the built in functions work.
Example: Rules implemented and Acceptable values.
Indeed, we are using a home-made variety so we can be sure it works for all valid e-mailaddresses, instead of what OS deems acceptable.
Kilian -

That's only a good idea if you are NOT using those email addresses to send through the standard Email system. Why? Because there are acceptable email addresses according to the SMTP RFC that the OutSystems system reject (likes ones with a hypen in the name). So while you may be meeting the SMTP spec, you are setting yourself up to accept email addresses that you cannot send to.

Justin, we're actually not using the standard e-mail too much, most gets send by Richmail, and we also have an Exchange connector. And in practice, I don't think many exotic e-mail addresses will be entered.

This is the email regular expression we are using on validate email addresses

^([a-z][a-z0-9.-]+)\\(?! +)([^\\/""[\]:|<>+=;,?*@]+)$
As long as we're sharing, this is the one we're using:

Granted, I didn't come up with it completely by myself :).
Kilian Hekhuis wrote:
Justin, we're actually not using the standard e-mail too much, most gets send by Richmail, and we also have an Exchange connector. And in practice, I don't think many exotic e-mail addresses will be entered.
 Kilian -

That makes sense. BUT... big but!

The vaidation on the built-in email sending throws out a lot of email addresses that I would not consider "exotic".

For example, using this as the "from":

"Barbarba Smith-Jones <>"

will get an "invalid email address" exception from the email system and not send.

That is not an "exotic" email address.

So for you, using the Richmail system, you can use this, but for someone using the standard mail system, this will fail, even though it is SMTP RFC valid.

Yeah, you're right, but also notice that we're just testing the actual e-mail address (the part between the angled brackets), not what's in front (which makes sense for e-mail addresses as entered by customers on web-sites, for example).
I have seen regex for email that were 4 pages long, I have seen easy ones..
but all I can say is, the email address can be pretty weird yet valid :)
Cool article! :D

Some people, when confronted with a problem, think, “I know, I’ll use regular expressions.” Now they have two problems.
(for visistors of #myNextStepNL => this looks like a "Bommeldingsformulier")
As for the quote, some more background information can be found here:

i am using built in fucntion EmailAddressValidate but when i am entering - EmailAddressValidate("xyz@gmail") it is returning true. Is this valid email address? i think
valid email address is - "".

Hi Manish,

Tecnically it's an email that you most likelly don't want to accept on a form, but tecnically it is a valid address, since the host part following the specification can be a simple dns name.


"2.3.5.  Domain Names

   A domain name (or often just a "domain") consists of one or more
   components, separated by dots if more than one appears.  In the case
   of a top-level domain used by itself in an email address, a single
   string is used without any dots.  This makes the requirement,
   described in more detail below, that only fully-qualified domain
   names appear in SMTP transactions on the public Internet"

So, for "public internet" a "xyz@gmail" should not be used, but it still is valid for example in a internal enterprise network using it's internal email server.

João Rosado
thanku so much João Rosado for quick and descriptive response. Now I have used Regex_Search() and my problem is solved.