Home > Uncategorized > Process a database of email addresses for real names.

Process a database of email addresses for real names.


If you have a mailing list, or database of users and email addresses, but it appears to be full of nicknames and “asdasdasd” nonsense, and you don’t want to send an email saying “Dear asdasdasd”, here’s some code I wrote using the AvatarAPI email resolution service;

static void Main(string[] args)
var strSQL = “sp_GetIncompleteNames”;
var dt =Database.PopulateDataTable(strSQL);
var intProgress = 0;
foreach(DataRow dr in dt.Rows)
Console.WriteLine(intProgress + ” Of ” + dt.Rows.Count);
var user = profile.Get(dr[“email”].ToString());
if (!string.IsNullOrEmpty(user.Name))
var realname = user.Name.Replace(“‘”, “”);
TextInfo textInfo = new CultureInfo(“en-US”, false).TextInfo;
realname = textInfo.ToTitleCase(realname);
strSQL = “update addressbook set name='” + realname + “‘ where email='” + dr[“email”].ToString() + “‘”;

It runs through each name in under a second, so you can process thousands in a few hours.


Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: