How to check whether a E-mail address is in correct format?

studio

#1

Hi Guys, I am facing a challenge now.

So here’s the thing. We have a user list with contacts such as phone number and e-mail. The robot need to send e-mail to each of the users on the list. But we found that when SMTP activity faces a wrong-format address, the robot stops automatically and doesn’t report the position or record. Is there any method that I can test the format of e-mail addresses on the list before sending mails?

Thanks and Happy New Year!

Aaron


#2

You can IsMatch activity with a Regex expression to check the email is in valid format or not.


#3

You can also try creating a new MailAddress instance of your input e-mail. If the format is not correct it will fail and you will get an exception message.

Like so:
Create a variable of type System.Net.Mail.MailAddress.
Try giving it your input: myMailAddr = New MailAddress(addressToBeVerified)

br,
Topi


#4

Hi @Topi,

It is not failing for the email address which contains slash “/”.
Eg. “s/kumari@uipath.com”


#5

Email syntax accepts slash. For more info:


#6

You can download Uipath.Email.Validation.Activities in manage packages created by saranpselvam. It contains Email validator activity that returns boolean type.


#7

Use IsMatch to match Regular Expression pattern:


Tomatch email:

Pattern: \b[A-Z0-9._%±]+@[A-Z0-9.-]+.[A-Z]{2,}\b
Input: qsc.wdv@uipath.com
RegexOption: Select checkboxes based on requirement