web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Validate Email Address
Power Automate
Answered

Validate Email Address

(1) ShareShare
ReportReport
Posted on by 136

Hi

 

I have a flow that recieves 'Get Responses' from MS Forms.

The Form asks the user a number of questions, and included is a question if they wish to recieve an email receipt of the data entered to the form, if they do it will ask them for their email address.

I've designed a email in Flow that if they request a email reciept ( condition in flow) then the email is sent.

But before I send the email in flow I want to validate if the email address is formatted correctly, can flow carry out this type of validation or what is the expression for it? ( So check that it contains '@', also has a dot etc)

Or alternatively if the email sending fails can I start another action of that?

 

If the email does not validate correctly then I will put a condition in so that our office team can contact the customer to let them know

 

Below a screenshot of my flow

screenshot.png

 

Categories:
  • Verified answer
    yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hey @bkeano 

     

    Yes. You can follow the steps as: 

    ccse3.PNG

     

    Expression: 

    contains(last(split(body('Get_response_details')?['r9f2ae5d6c71c4cdc88fcf52ebc7d86ed'],'@')),'.')

    In the expression, remove everything from body upto the ]. Place cursor here and from the dynamic content select the email field of the form. 

     

    This expression will check if the last part of the string split at @ contains a '.'. If it does, the value is true and you have the send email to customer in the yes branch and if no send the email to a team member with any relevat details. 

     

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

     

     

  • manuelstgomes Profile Picture
    6,643 on at

    Hi @bkeano 

     

    The easiest way to validate this would be to use regular expressions, but Flow doesn't support them yet.

     

    There's already a proposal under review to support this.

    https://powerusers.microsoft.com/t5/Flow-Ideas/Support-for-regex-either-in-conditions-or-as-an-action-with/idi-p/24768

     

    A quick workaround would be to use a service that validates that for you. I've found a free that you can use. Just create an account at https://mailboxlayer.com (they support up to 250 queries a day for free so check if this is enough for you) and use the API as follows: 

     

    small-Screenshot_2019-10-04_at_10_44_50.jpg

     

    You can get the API key in your account. Please note that there are a lot of services like this. This was the first one I found and works 🙂

     

    Does this help you?

     

    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

    Cheers
    Manuel

     

  • v-litu-msft Profile Picture
    Microsoft Employee on at

    Hi @bkeano,

     

    Has your problem been solved?
    If your problem has been solved, You could go ahead and mark the post as solved by clicking “Accept as Solution” so that this thread will be marked for other users to easily identify!

    Best Regards,
    Community Support Team _ Lin Tu

  • SNARANJO Profile Picture
    8 on at

    Good aproach to the solution, but first you need to verify that there´s a "@" in the string, failing to do so, may validate strings without the "@" like for example: "a.b.c.com"

     

    So, these would be the two validations to verify for a valid email address on a String:

     

    contains(*The Email Address String Goes Here*,'@')

    AND

    contains(last(split(*The Email Address String Goes Here*,'@')),'.')

     


    SNARANJO_0-1624295982011.png

     

     

  • adylim Profile Picture
    19 on at

    this is great! @SNARANJO ! I'm now trying to work on the case if the user enters abc@domain.com@domain.com (yes this has happened).. not sure how I can achieve the "there should only be 1 '@' and 1 '.'

  • SNARANJO Profile Picture
    8 on at

    If request amount is not too bulky you can always ask your self for string validation using an adaptive card from the Flow bot to you with the string you need to double check.

     

    In this case i check the text string for these and other characters: space " " "<" "mailto:" "/" "," ";" etc. You could build an expression to find two or more "@" in the same string as well.

     

    There are some very helpfull videos on coding the adaptive cards on youtube. (These may be tricky)

     

    By using this simple form you avoid sharing an email address to some unknown server over the internet for "validation".

     

    SNARANJO_0-1628010159596.png

     

     

     

    {
    "inputs": {
    "host": {
    "connectionName": "shared_teams",
    "operationId": "SubscribeUserFlowContinuation",
    "apiId": "/providers/Microsoft.PowerApps/apis/shared_teams"
    },
    "parameters": {
    "UserFlowContinuationSubscriptionRequest/body/recipient/to": "you@yourdomain.com;",
    "UserFlowContinuationSubscriptionRequest/body/messageBody": "{\n \"$schema\": \"http://adaptivecards.io/schemas/adaptive-card.json\",\n \"type\": \"AdaptiveCard\",\n \"version\": \"1.2\",\n \"body\": [\n {\n \"type\": \"TextBlock\",\n \"text\": \"Check Email @{Your input text to verify}\",\n \"weight\": \"Bolder\",\n \"size\": \"Medium\"\n },\n {\n \"type\": \"TextBlock\",\n \"text\": \"Please check this email:\",\n \"isSubtle\": true,\n \"wrap\": true\n },\n {\n \"type\": \"TextBlock\",\n \"text\": \"Email to check: @{Your input text to verify}\",\n \"wrap\": true\n },\n {\n \"type\": \"Input.Text\",\n \"id\": \"RevisedEmail\",\n \"placeholder\": \"user@domain.com\",\n \"spacing\": \"None\",\n \"style\": \"Email\"\n },\n ],\n \"actions\": [\n {\n \"type\": \"Action.Submit\",\n \"title\": \"Submit\"\n }\n ]\n}",
    "UserFlowContinuationSubscriptionRequest/body/updateMessage": "Email verified OK!",
    "UserFlowContinuationSubscriptionRequest/body/shouldUpdateCard": true,
    "UserFlowContinuationSubscriptionRequest/body/recipient/isAlert": true
    },
    "authentication": "@parameters('$authentication')"
    }
    }

     

  • adylim Profile Picture
    19 on at

    great solution!! I will give this a try! thanks! @SNARANJO 

  • abonahoom Profile Picture
    85 on at

    This is a great solution, but I'm running into the problem that if the email is blank than I don't want anything to happen and now my flow is showing that it's failing but it's actually working.  Is there a workaround that I can verify that an email address has or has not been entered and if yes than an email is sent and if no than nothing happens?  The error I'm receiving is "'Email' at line '1' and column '3316': 'The template language function 'contains' expects its first argument 'collection' to be a dictionary (object), an array or a string. The provided value is of type 'Null'.'.".  Any help is appreciated, thanks in advance!

  • adylim Profile Picture
    19 on at

    do you have a screenshot of your flow? to handle blank email, I usually put a condition of a string evaluation of the email ahead of the actions I want to perform

  • 46EMILY Profile Picture
    23 on at

    Hi, still need help on this issue?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 307 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 289

#3
Henil Profile Picture

Henil 127

Last 30 days Overall leaderboard