Validate an Email Address

  • Thread starter Thread starter John Wright
  • Start date Start date
J

John Wright

I want to validate an email address against our Exchange server. Anyone
have code or point me in the right direction?


John
 
I want to validate an email address against our Exchange server. Anyone
have code or point me in the right direction?

John

If you're not meaning domain validation, but format validation of mail
address, you can use Regex pattern to check if it's a valid e-mail
address:

'-----Begin-------
Imports System.Text.RegularExpressions

Dim pattern As String
' I hope pattern is proper
pattern = "\w+([-+.]\w)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
If Regex.IsMatch("mail_here", pattern) = True Then
MsgBox("Valid mail address!")
Else
MsgBox("Invalid mail address!")
End If
'-----End-------


Hope this helps,

Onur Güzel
 
Back
Top