cptnalgren
Gebruiker
- Lid geworden
- 20 dec 2007
- Berichten
- 49
Je kan een email adres controleren via onderstaande code :
maar is er een mogelijkheid om na te gaan of het email adres echt bestaat?
Code:
Function EmailCheck(ByVal emailAddress As String) As Boolean
'Specify the regex
Dim pattern As String = "^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"
Dim emailAddressMatch As Match = Regex.Match(emailAddress, pattern)
'Show result
If emailAddressMatch.Success Then
MessageBox.Show(emailAddress & " = Valid email", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
MessageBox.Show(emailAddress & " = Invalid email", MessageBoxButtons.OK, MessageBoxIcon.Stop)
End If
End Function