Archive Browser
Download OutlookEmailAddressExtract.zip version 1.0.0.0, last updated 26/09/2012 (27.15 KB)
Download- md5: 8ff6f5d3e6a03b2efeb65db5b2735ea5
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
namespace OutlookEmailAddressExtract
{
internal class Program
{
private static void FolderScanningHandler(object sender, MAPIFolderEventArgs e)
{
Program.WriteProgress(string.Format("Scanning {0} of {1}: {2}", e.CurrentItem, e.TotalItems, e.Folder.FolderPath));
}
private static void Main(string[] args)
{
List<string> addresses;
OutlookEmailAddressExtractor extractor;
Options options;
Program.WriteHeader();
extractor = new OutlookEmailAddressExtractor();
extractor.FolderScanning += Program.FolderScanningHandler;
options = Options.Recipient | Options.Sender | Options.SubFolders;
// If you want to filter to only return emails from a given domain, uncomment the lines below and enter your domains
/*
extractor.IncludedDomains.Add("yourdomain1.com");
extractor.IncludedDomains.Add("yourdomain2.co.uk");
options |= Options.FilterByDomain;
*/
extractor.Options = options;
Program.WriteOptionsHeader(options);
addresses = new List<string>(extractor.ExtractAddresses());
File.WriteAllLines(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "addresses.txt"), addresses.ToArray());
Program.WriteProgress("Scan complete.");
Console.WriteLine("\n{0} addresses found.", addresses.Count);
Console.WriteLine("\nPress <Enter> to exit");
Console.ReadKey();
}
private static void WriteHeader()
{
FileVersionInfo fileVersion;
fileVersion = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location);
Console.WriteLine(fileVersion.ProductName);
Console.WriteLine(string.Format("Version {0}", fileVersion.ProductVersion));
}
private static void WriteOptionsHeader(Options options)
{
Console.WriteLine();
Console.WriteLine("Scanning for: {0}", options);
}
private static void WriteProgress(string message)
{
if (message.Length > Console.WindowWidth)
message = string.Concat(message.Substring(0, Console.WindowWidth - 3), "...");
Console.SetCursorPosition(0, 5);
Console.WriteLine(new string(' ', Console.WindowWidth));
Console.SetCursorPosition(0, 5);
Console.WriteLine(message);
}
}
}
Donate
This software may be used free of charge, but as with all free software there are costs involved to develop and maintain.
If this site or its services have saved you time, please consider a donation to help with running costs and timely updates.
Donate