Click here to Skip to main content
13,869,141 members
Click here to Skip to main content
Add your own
alternative version


73 bookmarked
Posted 9 Aug 2006

Tracking Emails for Open/Read

, 9 Aug 2006
Rate this:
Please Sign up or sign in to vote.
Tracking Emails for Open/Read


Most of the email users get a number of opt-in emails each day. Many of you might have noticed that a marketing campaign starts and sends out a number of emails. At the beginning, you might have interested reading such advertising. And eventually you stopped reading them. But the marketing company would not stop sending you emails and you also didn't opt-out yourself from the mailing list! Although after a certain period of time, you might have noticed that the company stopped sending you further emails.

Question is that, did they stop their campaign? Answer is 'possibly no'. So why they stopped sending you email. Did they know that you are not reading their emails? Answer is 'probably yes!' 'Yes?' - but how they could know that you are no longer interested in reading their email offers?


It's all about a technique called 'email tracking'. By email tracking, a marketing company can track whether you read a particular post. That is, after sending emails to you, they can track out whether you've read those emails at all. Even surprisingly, they can also track the location and date/time when (and from where) you've read those emails!

Is it really possible at all? Yes technically it's very easy to track emails whether they are read or not!

Before we go into too depth, we must understand that only email containing HTML as part of its MIME type can be used to be tracked. As you know, in an HTML email we can easily put a graphics in it. Graphics can be very nice image, or it can simply be an invisible image (a transparent image with 1x1 size for example).

When we put an image into an HTML source we write similar to the following:

<img src="some-source-onto-your-server.gif"/>

But when it's required to track an e-mail's status, the src property of the <img> element looks a bit trickier. Consider the following:

<img src="ImageServer.aspx?imageID=track.jpg& custID=134ghxx34343ai& campID=32434"/>

Using the code

As you can guess easily that the image source url itself (the src property of the <img> tag) does not point to an image type file, instead it's a query string to be executed within an .aspx file (may be also .jsp, .php etc.). That's all behind the scene. The code inside the ImageServer.aspx.cs is as simple as following:

private void Page_Load(object sender, System.EventArgs e)
    // content type should be resolved programmatically
    Response.ContentType = "image/jpeg";
    if (!IsPostBack) Track();

When the browser sends a GET method using the above query string, the .aspx file parses the query, determines who the user opens the email up to read, then the program stores a flag in the database table to indicate that a particular email for a particular campaign has been opened by the customer. Additionally the program can also store other information; such as date/time information, remote IP to determine location information etc.

In my code, I have used an index.aspx file as if it were an email previously sent to a customer to mimic the fact when such email tracking occures in real life.

Test vs Real Life Project

Please bear in mind that in a real life and fit-to-production-environment email campaign solution, this implementation can't give the ultimate performance. Usually for such big real life project, one need to implement fully fledged tracking server, which acts like a web server (almost like the IIS itself).

Final Thoughts

Upon only one reason the above program may fail to track to determine whether a particular email has been opened or not - if the email client (such as Yahoo or MSN) disables the graphics to be downloaded for email containing HTML content. In Yahoo Mail, user can set their preference not to download graphics for their emails. In this case <img> tags are tweaked by the Yahoo Server, and hence no graphics would be downloaded from other servers. So as no image to download, no tracking to occur at the marketing agent's end!!!

That's all about email tracking!!


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

Mohammad Ali Azam
Architect TechAnts Technologies Limited
Bangladesh Bangladesh

Mohammad Ali Azam has been working as an Architect in TechAnts Technologies Limited, located in Dhaka, Bangladesh since 2008.

Azam had long been working as a Senior Java Enterprise Architect in several companies and now has been working on software development using ASP.NET platform. He is as competent in both Visual C# and Visual Basic .NET as he is in J2EE.

For last couple of years, he has actively been working on Email Campaign Software, ECMS, Search Engine Integration, Hospital Management System, Knowledge Management System, Human Resource Management System and open source PHP web application such as Joomla, WordPress and Magento. Along with his regular tasks in the industry, he has also been researching on inventing technologies to promote Rapid Application Development (RAD).

While he works on designing various component models utilizing the best industry practices and the latest specification of UML, at leisure, he plays with his little baby girl and watches Sci-Fi movies on satellite TVs (or on DVDs) with his

You may also be interested in...

Comments and Discussions

QuestionEmail Tracking Pin
Milton B.29-Jan-16 7:09
professionalMilton B.29-Jan-16 7:09 
GeneralTrackimg for email is not working in Gmail account Pin
Member 1053231630-Mar-14 20:42
memberMember 1053231630-Mar-14 20:42 
QuestionExpose User ID? Pin
Tam Vu11-Jan-11 5:18
memberTam Vu11-Jan-11 5:18 
QuestionWhat if User not Click on display images... Pin
shaikhsamir4-Aug-10 1:13
membershaikhsamir4-Aug-10 1:13 
AnswerRe: What if User not Click on display images... Pin
zorou11-Dec-10 17:07
memberzorou11-Dec-10 17:07 
GeneralNot Working..please help. Pin
S.R.Sahoo3-Jun-10 22:35
memberS.R.Sahoo3-Jun-10 22:35 
Questionlinks to email tracking server programs Pin
Jayapal Chandran13-Nov-09 20:23
memberJayapal Chandran13-Nov-09 20:23 
GeneralEmail Tracking on Forward and Spam Emails Pin
Member 28126005-Aug-08 3:59
memberMember 28126005-Aug-08 3:59 
QuestionTracking Email for open/read Pin
sudhir_kr22-Jul-08 21:56
membersudhir_kr22-Jul-08 21:56 
AnswerRe: Tracking Email for open/read Pin
Mohammad Ali Azam5-Aug-08 21:28
memberMohammad Ali Azam5-Aug-08 21:28 
GeneralRe: Tracking Email for open/read Pin
sudhir_kr24-Aug-08 22:13
membersudhir_kr24-Aug-08 22:13 
Questioncan u help me to use this for validating email address?? Pin
ibtesam_bloch19-Feb-07 23:08
memberibtesam_bloch19-Feb-07 23:08 
AnswerRe: can u help me to use this for validating email address?? Pin
Mohammad Ali Azam27-Feb-07 4:23
memberMohammad Ali Azam27-Feb-07 4:23 
GeneralBetter if you use in this way [modified] Pin
Sameers.ME19-Aug-06 3:51
memberSameers.ME19-Aug-06 3:51 
GeneralRe: Better if you use in this way Pin
Mohammad Ali Azam27-Feb-07 4:25
memberMohammad Ali Azam27-Feb-07 4:25 
GeneralRe: Better if you use in this way Pin
Rabindranathsenpati16-Mar-07 5:12
memberRabindranathsenpati16-Mar-07 5:12 
GeneralRe: Better if you use in this way Pin
Sameers.ME16-Mar-07 11:37
memberSameers.ME16-Mar-07 11:37 
GeneralSmart technique, but ... Pin
mgungora16-Aug-06 2:40
membermgungora16-Aug-06 2:40 
GeneralRe: Smart technique, but ... Pin
Mohammad Ali Azam16-Aug-06 22:16
memberMohammad Ali Azam16-Aug-06 22:16 
GeneralTracking email: nice but... Pin
Ngo Tran Anh16-Aug-06 0:53
memberNgo Tran Anh16-Aug-06 0:53 
GeneralRe: Tracking email: nice but... Pin
Mohammad Ali Azam16-Aug-06 22:13
memberMohammad Ali Azam16-Aug-06 22:13 

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 | Cookies | Terms of Use | Mobile
Web03 | 2.8.190214.1 | Last Updated 9 Aug 2006
Article Copyright 2006 by Mohammad Ali Azam
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid