Email authentication

Hiiii guys, i have a scenario where we need to give the input our mail through input dialog activity and need to use if condition where the condition is the mail has to contain1) @2) after the @ it has to contain dot(.) 3)after dot(.) it must contain 3characters. If the above conditions are not satisfied it has to give the output as false or error. Example the exact output should be like uipathforum@gmail.com here we use use whatever it may not only Gmail, whether it may be outlook or any thing.

Hi @venkatmalla6,
Would this help if you use “Is match” activity and in the pattern you will place a relevant regex, like e.g. “^\S*@\S*[.]…\b” - which will detect any string starting from zero or more non-whitespace characters followed by “@” followed by zero or more non-whitespace characters followed by “.” followed by three single characters right after which you are marking your word boundary? You can try it on https://regex101.com/ and play with its construction accordingly. Does this solve your problem? :slight_smile:

Hi @venkatmalla6 - Use Split(“Your String”,"@"). Store this output in String Array. Array(0) gives you the string before “@” and Array(1) gives you the string after “@”. With the Array(1) you can check whether it contains “.”. Once that done with Array(1) you can apply Split (“Array(1)”,".") then that SubArray(1) will gives you “.com” which you can check further.

Thanks,
AK

Hi @venkatmalla6,
You could try something like this:
image
It requires a little touch with better regex expression but overall it’s working.
Expression:
image
Condition:

1 Like

@Pablito @PAD hii thanks for the reply,actually i’m not good at regex,if any alternate solutions are there plz share. thank you

Hi @venkatmalla6
Does the below screenshot help you in the application of “Is match”? Regex is in fact quite easy to learn. Try “^\S*[@]\S*[.]…\b” - it works for me, but it will pick up the addresses where you will have exactly three characters after a dot. Let me know if this has to be more flexible.

@AnandKumar26 if the entered mail has no @ then the process you said it don’t work right.

@venkatmalla6 - If that is the case then apply a condition that YourString.Contains("@"), if it is yes then proceed the next steps respectively.

Thanks
AK

@AnandKumar26

as you can see my flow if i run it it works,say for example if i give venkatmalla@gmail.com it gives output as correct but if i give as venkat@mallagmail.comeven this is also works but it is not the way we want our output right it should be in a manner how a normal mailidl looks like.

@PAD hii i used the regex which you used above saying incorrect for every mail id.

Have you tried the second one - “^\S*[@]\S*[.]…\b”? If your addresses contain more or less than 3 letters after the dot, then it will show them as invalid.

@PAD yeah i tried this one only but it is giving incorrect output

regex.xaml (6.4 KB) that is odd as it works for me - try the attached workflow. Bear in mind that this regex will show you both venkat@mallagmail.com and venkatmalla@gmail.com as correct - you didn’t state any more conditions the address should meet… If you want the automation to recognize whether it contains “gmail” alone, then the regex should be different too, not to mention that you would have to probably construct some sort of dictionary of valid addresses for the robot to use.