Click here to Skip to main content
13,357,648 members (75,842 online)
Click here to Skip to main content
Add your own
alternative version


17 bookmarked
Posted 14 Jul 2001

An email collection program

, 11 Aug 2001
Rate this:
Please Sign up or sign in to vote.
This is a small program that can extract email addresses from files that are not necessarily text files.
<!-- Download Links --> <!-- Article image -->

Sample Image - email_collect.gif

<!-- Main HTML starts here -->


This is a small program that can extract email addresses from files that are not necessarily text files.

The program works by opening the input file as a binary file. If an '@' sign is found in the file, the program "backs up" in the file to find the first character that could not be a valid email character.

Then, the email address is collected and stored in an array which is placed in memory. This process continues until the end of file is reached.

When the entire input file is read, the addresses are sorted in alphabetical order, and duplicate addresses are removed. Email addresses that are found in the file are shown in an edit box.

Additionally, a text file containing the same list is created (called emails.txt) in the root directory.

All enhancements and modifications are left to the creativity and imagination of the progrmamer.

Note: This program demonstrates the use of a very efficient sort algorithm. Also, this program shows beginning programmers how to allocate and free memory. Other items of potential interest show file positioning and removal of duplicate entries.


12 Aug 2001 - I incorporated a suggestion from a codeproject member, fixed a few bugs, and then made many improvements to the program. The program now can collect up to 250,000 email addresses per file.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Scott Wenger
United States United States
Scott Wenger

You may also be interested in...

Comments and Discussions

GeneralMy vote of 5 Pin
xuplus18-Nov-10 23:26
memberxuplus18-Nov-10 23:26 
Questionhow to detect what files attached in the mail? Pin
vanta6-Feb-03 23:31
membervanta6-Feb-03 23:31 
Hello everyone,
Could you help me?
My question:
i have an email xxx.eml (Microsoft Outlook Express file)
I want to know what files attached in xxx.eml by my tool in stead of M Outlook Express.

So, Could you tell me how to code (in Visual C++) ?
or you can tell me the format of *.eml files ??

Thank you.
I am waiting for you.

Programmer -
Room No 408,123 Truong Dinh st,Dist. 3,HCM City,Viet Nam
Tel: +84 (8) 932 1045

GeneralJBuilder 6 and reading Excel file Pin
fsy21-Sep-02 1:18
memberfsy21-Sep-02 1:18 
Generalloop unrolling Pin
carel16-Jul-01 7:12
membercarel16-Jul-01 7:12 
GeneralBad link Pin
xlam15-Jul-01 18:47
memberxlam15-Jul-01 18:47 
GeneralRe: Bad link Pin
Chris Maunder15-Jul-01 19:41
memberChris Maunder15-Jul-01 19:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.180111.1 | Last Updated 12 Aug 2001
Article Copyright 2001 by Scott Wenger
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid