Checks an email address for validity at the requested level, and provides suggested corrections.
Language:
<!-- Import the Integr8 Ajax API -->
<!-- NOTE: Get your own API key to use in the following script tag from: -->
<!-- http://www.data-8.co.uk/integr8/Admin/Ajax.aspx -->
<script src="http://webservices.data-8.co.uk/Javascript/Loader.ashx?key=your-api-key" type="text/javascript">
</script>
<script type="text/javascript">
function loadIntegr8() {
// Load the EmailValidation Integr8 service
data8.load('EmailValidation');
}
function Cleanse(email, level, record) {
/// <param name="email">string</param>
/// <param name="level">string. One of the following values: Syntax, MX, Server, Address</param>
/// <param name="record">data8.businessinputrecord. Set up the CompanyName, Name, Address properties before calling this method.</param>
var emailvalidation = new data8.emailvalidation();
emailvalidation.cleanse(
email,
level,
record,
null,
showCleanseResult
);
}
function showCleanseResult(result) {
// Check that the call succeeded, and show the error message if there was a problem.
if (!result.Status.Success) {
alert('Error: ' + result.Status.ErrorMessage);
}
else {
// TODO: Process method results here.
// Results can be extracted from the following fields:
// result.Result
// Contains a status code indicating if the email address could be validated.
// result.OriginalValid
// Indicates if the original email address was valid before being modified.
// result.EmailType
// Indicates what type of email address was supplied.
// result.SuggestedEmailAddress
// A suggested correction of the email address
// result.Comment
// A free-text description of why the email address was modified
// result.Salutation
// The suggested name to be used in the greeting line of an email
// result.StructureUsed
// A description of the structure of the username part of the email address
}
}
loadIntegr8();
</script>
// NOTE: A reference to the web service must be added in Visual Studio with the URL
// http://webservices.data-8.co.uk/EmailValidation.asmx
private void Cleanse(string email, EmailValidationLevel level, BusinessInputRecord record)
{
// Invoke the web service method.
EmailValidation proxy = new EmailValidation();
EmailCleanseOutput results = proxy.Cleanse("username", "password", email, level, record, null);
// Check that the call succeeded, and show the error message if there was a problem.
if ((results.Status.Success == false))
{
MessageBox.Show(("Error: " + results.Status.ErrorMessage));
}
else
{
// TODO: Process method results here.
// Results can be extracted from the following fields:
// result.Result
// Contains a status code indicating if the email address could be validated.
// result.OriginalValid
// Indicates if the original email address was valid before being modified.
// result.EmailType
// Indicates what type of email address was supplied.
// result.SuggestedEmailAddress
// A suggested correction of the email address
// result.Comment
// A free-text description of why the email address was modified
// result.Salutation
// The suggested name to be used in the greeting line of an email
// result.StructureUsed
// A description of the structure of the username part of the email address
}
}
'NOTE: A reference to the web service must be added in Visual Studio with the URL
'http://webservices.data-8.co.uk/EmailValidation.asmx
Private Sub Cleanse(ByVal email As String, ByVal level As EmailValidationLevel, ByVal record As BusinessInputRecord)
'Invoke the web service method.
Dim proxy As EmailValidation = New EmailValidation()
Dim results As EmailCleanseOutput = proxy.Cleanse("username", "password", email, level, record, Nothing)
'Check that the call succeeded, and show the error message if there was a problem.
If (results.Status.Success Is false) Then
MessageBox.Show(("Error: " + results.Status.ErrorMessage))
Else
'TODO: Process method results here.
'Results can be extracted from the following fields:
'result.Result
' Contains a status code indicating if the email address could be validated.
'result.OriginalValid
' Indicates if the original email address was valid before being modified.
'result.EmailType
' Indicates what type of email address was supplied.
'result.SuggestedEmailAddress
' A suggested correction of the email address
'result.Comment
' A free-text description of why the email address was modified
'result.Salutation
' The suggested name to be used in the greeting line of an email
'result.StructureUsed
' A description of the structure of the username part of the email address
End If
End Sub
Public Sub Cleanse(email As String, level As String, title As String, forename As String, middleName As String, surname As String, company As String, address As String)
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "http://webservices.data-8.co.uk/recordset.ashx?service=EmailValidation&method=CleanseSimple" &
"&username=your-username" &
"&password=your-password" &
"&email=" & email &
"&level=" & level &
"&title=" & title &
"&forename=" & forename &
"&middleName=" & middleName &
"&surname=" & surname &
"&company=" & company &
"&address=" & address
If rs.MoveFirst Then
If rs.Fields(0).Name = "Success" And rs.Fields(0).Value = false Then
MsgBox "Error: " & rs.Fields(1)
Else
'TODO: Process method results here.
'All the results are available in the first row in the recordset.
'Results can be extracted from the following fields:
'Result
' Contains a status code indicating if the email address could be validated.
'OriginalValid
' Indicates if the original email address was valid before being modified.
'EmailType
' Indicates what type of email address was supplied.
'SuggestedEmailAddress
' A suggested correction of the email address
'Comment
' A free-text description of why the email address was modified
'Salutation
' The suggested name to be used in the greeting line of an email
'StructureUsed
' A description of the structure of the username part of the email address
End If
End If
End Sub
// NOTE: The php_soap.dll extension must be enabled in the php.ini file.
function Cleanse($email, $level, $record)
{
$params = array(
"username" => "your-username",
"password" => "your-password",
"email" => $email,
"level" => $level,
"record" => $record,
"options" => $options
);
$client = new SoapClient("http://webservices.data-8.co.uk/EmailValidation.asmx?WSDL");
$result = $client->Cleanse($params);
if ($result->CleanseResult->Status->Success == 0)
{
echo "Error: " . $result->CleanseResult->Status->ErrorMessage;
}
else
{
// TODO: Process method results here.
// Results can be extracted from the following fields:
// $result->CleanseResult->Result
// Contains a status code indicating if the email address could be validated.
// $result->CleanseResult->OriginalValid
// Indicates if the original email address was valid before being modified.
// $result->CleanseResult->EmailType
// Indicates what type of email address was supplied.
// $result->CleanseResult->SuggestedEmailAddress
// A suggested correction of the email address
// $result->CleanseResult->Comment
// A free-text description of why the email address was modified
// $result->CleanseResult->Salutation
// The suggested name to be used in the greeting line of an email
// $result->CleanseResult->StructureUsed
// A description of the structure of the username part of the email address
}
}