Quickstart#

Introduction#

Email Object allows your Web sites and custom applications to update email addresses in your database files while verifying and correcting misspelled domain names.

Sample Code#

Email Object is compatible with multiple coding languages across different systems. The table below will link you to the sample code for each language hosted in the github repositories.

Language

System

Repository

C# .NET

Windows

melissa_favicon MelissaData/EmailObject-Dotnet

Linux

melissa_favicon MelissaData/EmailObject-Dotnet-Linux

melissa_favicon MelissaData/EmailObject-Dotnet-Wrappers

C++

Windows

melissa_favicon MelissaData/EmailObject-Cpp

Linux

melissa_favicon MelissaData/EmailObject-Cpp-Linux

Java

Windows

melissa_favicon MelissaData/EmailObject-Java

Linux

melissa_favicon MelissaData/EmailObject-Java-Linux

melissa_favicon MelissaData/EmailObject-Java-Wrappers

Python3

Windows

melissa_favicon MelissaData/EmailObject-Python3

Linux

melissa_favicon MelissaData/EmailObject-Python3-Linux

melissa_favicon MelissaData/EmailObject-Python3-Wrappers

How To Get Data#

Use the Melissa Updater to download the data files using the manifest named dq_email_data.

Getting Started#

Basic Flow of Actions#

To use the Email Object, you can give it a license, data path, and email. It will then analyze the email and store relevant information about it. It can also return result codes based on the validity of the email.

This is the flow of how Email Object is usually implemented:

The Reference Guide goes into detail on every method available with the Email Object. All the Result Codes and descriptions are also in the reference guide.

1. Initialize Email Object#

Start by creating an instance of the Melissa Email Object.

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
// Create instance of Melissa Email Object
public mdEmail mdEmailObj = new mdEmail();
// Create instance of Melissa Email Object
mdEmail* mdEmailObj = new mdEmail;
// Create instance of Melissa Email Object
mdEmail mdEmailObj = new mdEmail();
# Create instance of Melissa Email Object
md_email_obj = mdEmail_pythoncode.mdEmail()

2. Set a License#

To set a license, either configure the environmental variable for the license or use the method SetLicenseString.

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
// Set license string
mdEmailObj.SetLicenseString(MELISSA_LICENSE_STRING);
// Set license string
mdEmailObj->SetLicenseString(MELISSA_LICENSE_STRING.c_str());
// Set license string
mdEmailObj.SetLicenseString(MELISSA_LICENSE_STRING);
# Set license string
md_email_obj.SetLicenseString(MELISSA_LICENSE_STRING)

To see when the license will expire, use the method GetLicenseStringExpirationDate.

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
Console.WriteLine($"Expiration Date: {mdEmailObj.GetLicenseStringExpirationDate()}");
cout << "Expiration Date: " + string(mdEmailObj->GetLicenseStringExpirationDate()) << endl;
System.out.println("Expiration Date: " + mdEmailObj.GetLicenseStringExpirationDate());
print(f"Expiration Date: {md_email_obj.GetLicenseStringExpirationDate()}")

3. Initialize Data Files#

To set the path for the data files, use the method SetPathToEmailFiles.

Use the method InitializeDataFiles to setup the data files.

ProgramStatus can be used to store the result from InitializeDataFiles to ensure it worked as expected.

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
// Set path to data files (.dat, etc)
mdEmailObj.SetPathToEmailFiles(PATH_TO_DATA_FILES);
mdEmail.ProgramStatus pStatus = mdEmailObj.InitializeDataFiles();

if (pStatus != mdEmail.ProgramStatus.ErrorNone)
{
    // Problem during initialization
    Console.WriteLine("Failed to Initialize Object.");
    Console.WriteLine(pStatus);
    return;
}
// Set path to datafiles (.dat, etc)
mdEmailObj->SetPathToEmailFiles(PATH_TO_DATA_FILES.c_str());
mdEmail::ProgramStatus pStatus = mdEmailObj->InitializeDataFiles();

if (pStatus != mdEmail::ProgramStatus::ErrorNone)
{
    // Problem during initialization
    cout << "Failed to Initialize Object." << endl;
    cout << pStatus << endl;
    return;
}
// Set path to data files (.dat, etc)
mdEmailObj.SetPathToEmailFiles(PATH_TO_DATA_FILES);
mdEmail.ProgramStatus pStatus = mdEmailObj.InitializeDataFiles();

if (pStatus != mdEmail.ProgramStatus.ErrorNone) {
    // Problem during initialization
    System.out.println("Failed to Initialize Object.");
    System.out.println(pStatus);
    return;
}
# Set path to data files  (.dat, etc)
md_email_obj.SetPathToEmailFiles(PATH_TO_DATA_FILES)
p_status = md_email_obj.InitializeDataFiles()

if (p_status != mdEmail_pythoncode.ProgramStatus.ErrorNone):
    # Problem during initialization
    print("Failed to Initialize Object.")
    print(p_status)
    return

To check at what date the database was updated, use the method GetDatabaseDate.

The method GetBuildNumber gives the development build number of Email Object.

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
// If you see a different date than expected, check your license string and either download
// the new data files or use the Melissa Updater program to update your data files.
Console.WriteLine($"DataBase Date: {mdEmailObj.GetDatabaseDate()}");

// This number should match with file properties of the Melissa Object binary file.
// If TEST appears with the build number, there may be a license key issue.
Console.WriteLine($"Object Version: {mdEmailObj.GetBuildNumber()}\n");
// If you see a different date than expected, check your license string and either
// download the new data files or use the Melissa Updater program to update your data files.
cout << "DataBase Date: " + string(mdEmailObj->GetDatabaseDate()) << endl;

// This number should match with file properties of the Melissa Object binary file.
// If TEST appears with the build number, there may be a license key issue.
cout << "Object Version: " + string(mdEmailObj->GetBuildNumber()) << endl;
// If you see a different date than expected, check your license string and either
// download the new data files or use the Melissa Updater program to update your data files.
System.out.println("DataBase Date: " + mdEmailObj.GetDatabaseDate());

// This number should match with file properties of the Melissa Object binary file.
// If TEST appears with the build number, there may be a license key issue.
System.out.println("Object Version: " + mdEmailObj.GetBuildNumber());
# If you see a different date than expected, check your license string and either download
# the new data files or use the Melissa Updater program to update your data files.
print(f"DataBase Date: {md_email_obj.GetDatabaseDate()}")

# This number should match with file properties of the Melissa Object binary file.
# If TEST appears with the build number, there may be a license key issue.
print(f"Object Version: {md_email_obj.GetBuildNumber()}\n")

The method GetInitializeErrorString can get the status on errors in initialization. This can help determine if the code should continue running.

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
bool shouldContinueRunning = true;

if (mdEmailObj.GetInitializeErrorString() != "No error.")
{
    shouldContinueRunning = false;
}
bool shouldContinueRunning = true;

if (string(mdEmailObj->GetInitializeErrorString()) != "No error.")
{
    shouldContinueRunning = false;
}
Boolean shouldContinueRunning = true;

if (!mdEmailObj.GetInitializeErrorString().equals("No error."))
    shouldContinueRunning = false;
should_continue_running = True

if md_email_obj.GetInitializeErrorString() != "No error.":
    should_continue_running = False

4. Configure Email Object#

The following methods configure what information Email Object will look for:

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
// These are the configuarble pieces of the Email Object.
// We are setting what kind of information we want to be looked up
mdEmailObj.SetCorrectSyntax(true);
mdEmailObj.SetDatabaseLookup(true);
mdEmailObj.SetFuzzyLookup(true);
mdEmailObj.SetStandardizeCasing(true);
// These are the configuarble pieces of the Email Object.
// We are setting what kind of information we want to be looked up
mdEmailObj->SetCorrectSyntax(true);
mdEmailObj->SetDatabaseLookup(true);
mdEmailObj->SetFuzzyLookup(true);
mdEmailObj->SetStandardizeCasing(true);
// These are the configuarble pieces of the Email Object.
// We are setting what kind of information we want to be looked up
mdEmailObj.SetCorrectSyntax(true);
mdEmailObj.SetDatabaseLookup(true);
mdEmailObj.SetFuzzyLookup(true);
mdEmailObj.SetStandardizeCasing(true);
# These are the configuarble pieces of the Email Object.
# We are setting what kind of information we want to be looked up
md_email_obj.SetCorrectSyntax(True)
md_email_obj.SetDatabaseLookup(True)
md_email_obj.SetFuzzyLookup(True)
md_email_obj.SetStandardizeCasing(True)

5. Lookup and Verify the Email#

Use the method VerifyEmail to check the given email.

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
// This will call the lookup function to process the input phone
// as well as generate the result codes
mdEmailObj.VerifyEmail(EMAIL_STRING);
// This will call the lookup function to process the input phone
// as well as generate the result codes
mdEmailObj->VerifyEmail(EMAIL_STRING);
// This will call the lookup function to process the input phone
// as well as generate the result codes
mdEmailObj.VerifyEmail(EMAIL_STRING);
# This will call the lookup function to process the input phone
# as well as generate the result codes
md_email_obj.VerifyEmail(EMAIL_STRING)

6. Get Email Object Information#

The method GetEmailAddress will get the email given to the VerifyEmail method, including changes made.

The following methods can get specific data fields from the email:

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
mdEmailObj.GetEmailAddress();
mdEmailObj.GetMailBoxName();
mdEmailObj.GetDomainName();
mdEmailObj.GetTopLevelDomain();
mdEmailObj.GetTopLevelDomainDescription();
mdEmailObj->GetEmailAddress();
mdEmailObj->GetMailBoxName();
mdEmailObj->GetDomainName();
mdEmailObj->GetTopLevelDomain();
mdEmailObj->GetTopLevelDomainDescription();
mdEmailObj.GetEmailAddress();
mdEmailObj.GetMailBoxName();
mdEmailObj.GetDomainName();
mdEmailObj.GetTopLevelDomain();
mdEmailObj.GetTopLevelDomainDescription();
md_email_obj.GetEmailAddress()
md_email_obj.GetMailBoxName()
md_email_obj.GetDomainName()
md_email_obj.GetTopLevelDomain()
md_email_obj.GetTopLevelDomainDescription()

7. Get the Melissa Result Codes#

To get the result codes, use the method GetResults. This will return all of the result codes stacked together in a single String separated by ‘,’ delimiters.

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
String ResultCodes = mdEmailObj.GetResults();
string ResultCodes = mdEmailObj->GetResults();
String resultCodes = mdEmailObj.GetResults();
result_codes = md_email_obj.GetResults()

The following implementation shows one way of interpreting the results by using the method GetResultCodeDescription:

  • C#
  • C++
  • Java
  • Python3
mdEmailObj.GetResultCodeDescription(RESULT_CODE_STRING, mdEmail.ResultCdDescOpt.ResultCodeDescriptionLong);

// ResultsCodes explain any issues Email Object has with the object.
mdEmailObj->GetResultCodeDescription(RESULT_CODE_STRING.c_str(), mdEmailObj->ResultCodeDescriptionLong);

// ResultsCodes explain any issues Email Object has with the object.
mdEmailObj.GetResultCodeDescription(RESULT_CODE_STRING, mdEmail.ResultCdDescOpt.ResultCodeDescriptionLong);

// ResultsCodes explain any issues Email Object has with the object.
md_email_obj.GetResultCodeDescription(RESULT_CODE_STRING, mdEmail_pythoncode.ResultCdDescOpt.ResultCodeDescriptionLong)

# ResultsCodes explain any issues Email Object has with the object.