cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rhiheu
Advocate III
Advocate III

Stronger Email Address Validation

Hi,

Does anyone know of a stronger version of email address validation than the out-of-the-box one? (IsMatch( [EmailAddressFieldName], Email).

In particular, I want to stop the following possibilities from being accepted:

Essentially, I would like if if the text input field accepted ONLY 1 valid email, and nothing else, no other characters, no other email addresses. Essentially anything that would stop a Power Automate email flow from running, that triggers from the form being submitted in the Power App (I'm not sure what Power Automate is using to decide the content in it's To/Cc/Bcc fields is valid before it decides to fail or not). I'm fine with it failing after Outlook attempts to send it (e.g. a valid email address but one that doesn't actually exist) because then it returns an error notification email back to the user who then knows how to deal with it. The trouble with it failing in Power Automate is the user can't see why.

Thanks 🙂

2 ACCEPTED SOLUTIONS

Accepted Solutions
VDS_Mantra
Resolver I
Resolver I

Hi, 

 

You may use the below formula for Email Check 

If(And(IsMatch(TextInput2.Text,Email),Not(Find(" ",TextInput2.Text)>0),Not(Find(",",TextInput2.Text)>0),Not(Find("(",TextInput2.Text)>0)),"Good","Bad")

 

and set a error handler in flow by adding one more action of Email Send to User by add a Parallel branch Just down to your Email Option where you are using these mail id and from Option (...) of New Email action select the "Configure Run After"  Option and choose to "Has Failed". (see the attachment for reference)

 

Hope it will help you. 

 

 

View solution in original post

Hi @eka24 and @KrishnaV thanks for your replies but that wasn't quite what I was looking for sorry.

 

Hi @VDS_Mantra, that is great, thanks!! I've used your code and added a few more characters in just based on some of the failure examples I had:

If(And(IsMatch(TextInput2.Text,Email),Not(Find("(",TextInput2.Text)>0),Not(Find(")",TextInput2.Text)>0),Not(Find(",",TextInput2.Text)>0),Not(Find(":",TextInput2.Text)>0),Not(Find("<",TextInput2.Text)>0),Not(Find(">",TextInput2.Text)>0),Not(Find("[",TextInput2.Text)>0),Not(Find("]",TextInput2.Text)>0),Not(Find("\",TextInput2.Text)>0)), "Good","Bad")

Thanks for the error handling info too, I'll look into that as well.

 

I've learnt a lot more about email validation from this, it was a lot more complex than I expected, such as is described on Wikipedia (https://en.wikipedia.org/wiki/Email_address). I've decided to submit an idea too on the community to request a stronger inbuilt email validation function, if you're interested in voting for it the link is here.

View solution in original post

6 REPLIES 6
eka24
Super User III
Super User III

@rhiheu  Try:

On the Fill property

If(IsMatch(SearchBox.Text,"abc@gmail.com"),Blue,Green)
If i got you, you want only a particular email address nothing else example only "abc@gmail.com"
 
------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Hi @eka24, thanks for your reply. Sorry, I mean for it to accept any valid email and no other content in the field, not just abc@gmail.com.

eka24
Super User III
Super User III

In that case use:

IsMatch( "abc@gmail.com",Email)

Or

If(IsMatch(SearchBox.Text,Email),Blue,Green)

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

VDS_Mantra
Resolver I
Resolver I

Hi, 

 

You may use the below formula for Email Check 

If(And(IsMatch(TextInput2.Text,Email),Not(Find(" ",TextInput2.Text)>0),Not(Find(",",TextInput2.Text)>0),Not(Find("(",TextInput2.Text)>0)),"Good","Bad")

 

and set a error handler in flow by adding one more action of Email Send to User by add a Parallel branch Just down to your Email Option where you are using these mail id and from Option (...) of New Email action select the "Configure Run After"  Option and choose to "Has Failed". (see the attachment for reference)

 

Hope it will help you. 

 

 

View solution in original post

Hi @rhiheu ,

 

you can't control the user to enter the external domain emails. However, if you want to check within the domain you can do this:

If(IsBlank(LookUp(Office365Users.SearchUserV2().value, Mail = TextInput20.Text).Mail),"Not a Valid Email","Valid Email")

 
I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

Hi @eka24 and @KrishnaV thanks for your replies but that wasn't quite what I was looking for sorry.

 

Hi @VDS_Mantra, that is great, thanks!! I've used your code and added a few more characters in just based on some of the failure examples I had:

If(And(IsMatch(TextInput2.Text,Email),Not(Find("(",TextInput2.Text)>0),Not(Find(")",TextInput2.Text)>0),Not(Find(",",TextInput2.Text)>0),Not(Find(":",TextInput2.Text)>0),Not(Find("<",TextInput2.Text)>0),Not(Find(">",TextInput2.Text)>0),Not(Find("[",TextInput2.Text)>0),Not(Find("]",TextInput2.Text)>0),Not(Find("\",TextInput2.Text)>0)), "Good","Bad")

Thanks for the error handling info too, I'll look into that as well.

 

I've learnt a lot more about email validation from this, it was a lot more complex than I expected, such as is described on Wikipedia (https://en.wikipedia.org/wiki/Email_address). I've decided to submit an idea too on the community to request a stronger inbuilt email validation function, if you're interested in voting for it the link is here.

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,074)