Public Sub Example()
Dim emailValidator As EmailValidation = New EmailValidation() 'Trial Mode
'Dim emailValidator As EmailValidation = New EmailValidation("place user name here", "place license key here") 'License Mode
emailValidator.FromEmail = "someone@somewhere.com"
emailValidator.FromMailServer = "mail.somewhere.com"
'Create a list of 100 email addresses
Dim emailAddresses As List(Of String) = New List(Of String)()
For i As Integer = 1 To 100
emailAddresses.Add(String.Format("johnsmith{0}@hotmail.com", i))
Next i
'Attach Events
AddHandler emailValidator.ProgressEvent, AddressOf ProgressEvent
AddHandler emailValidator.ValidationCompleteEvent, AddressOf CompletionEvent
AddHandler emailValidator.ResponseReceivedEvent, AddressOf ResponseReceivedEvent
'Begin asynchronous validation
emailValidator.ValidateListAsync(emailAddresses)
Do While emailValidator.IsBusy
'Sleep 1 second
System.Threading.Thread.Sleep(1000)
Loop
'Remove the event connections
RemoveHandler emailValidator.ProgressEvent, AddressOf ProgressEvent
RemoveHandler emailValidator.ValidationCompleteEvent, AddressOf CompletionEvent
RemoveHandler emailValidator.ResponseReceivedEvent, AddressOf ResponseReceivedEvent
End Sub
Public Sub CompletionEvent(ByVal sender As Object, ByVal e As AsyncCompletedEventArgs)
Console.WriteLine("Finished. Validated emails")
End Sub
Public Sub ProgressEvent(ByVal sender As Object, ByVal args As ProgressEventArgs)
Console.WriteLine(String.Format("{0}% ({1} of {2}", args.ProgressPercentage, args.EmailsProcessed, args.TotalEmailsToProcess))
End Sub
Public Sub ResponseReceivedEvent(ByVal sender As Object, ByVal result As Result)
If result.IsValid Then
'Do something
Else
'Do something else
End If
Console.WriteLine(result.Log)
End Sub