Click here to Skip to main content
15,886,873 members
Articles / Web Development / ASP.NET
Article

Email Tracker

Rate me:
Please Sign up or sign in to vote.
3.79/5 (19 votes)
13 May 20041 min read 214.4K   3.1K   65   45
Track the emails you sent to people and you'll get alerted when somebody opens the email. Are spammers using this kind of tracking?

Introduction

Sample image

I was interested to see how spammers are tacking emails and I thought to create something like that .This little project shows you how to track emails you sent by adding a little track quote at the end. I also create it a program to remove this kind of tracking and flag the email as SPAM.

Using the code

There is only one function to use: AddTracking(string sBody, string sEmail, string sDomain)

C#
private string AddTracking(string sBody, string sEmail, string sDomain)
{ 
   string sRet = sBody + "<IMG height=1 src=\&quot;http://www." + 
                 sDomain + "/emailtrack.aspx?emailsent=" + sEmail + 
                 "\" width=1>";
   return (sRet); 
}

This function will add a LINK IMG at the end of the email that when loaded will actually be an ASPX page, that will alert you. Outlook and any mail editor that loads images will call the emailtrack.aspx with the parameter you added in the email. This is an error in the code above, I took the character '<' out so will display in this article.

Actually because I am addid HTML in the code, is difficult to see, I don't know how to make sure the article shows that code without adding weird formats

The Tracking page is pretty simple when receives the request:

C#
if ( Page.IsPostBack == false )
{    
    if ( Request.Params["emailsent"] != null )
        StampSentEmail(Request.Params["emailsent"].ToString());
}

Response.Redirect("none.gif");

So when the email editor (Outlook, Netscape) makes the request, the answer will be a transparent image, so won't show on the email.

You need to make sure you send an HTML email. The demo project uses the Mail namespace from .NET. On that class you must set

C#
mailMsg.BodyFormat = MailFormat.Html;

License

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


Written By
Web Developer
United States United States
Al is just another Software Engineer working in C++, ASp.NET and C#. Enjoys snowboarding in Big Bear, and wait patiently for his daughters to be old enough to write code and snowboard.

Al is a Microsoft ASP.NET MVP

Blog

Comments and Discussions

 
GeneralSource Code !! Pin
Member 176675628-Feb-05 2:24
Member 176675628-Feb-05 2:24 
GeneralRe: Source Code Pin
RamaPavan20-Dec-11 3:48
RamaPavan20-Dec-11 3:48 
GeneralSpelling mistake... Pin
Vadim Tabakman16-May-04 18:42
Vadim Tabakman16-May-04 18:42 
GeneralRe: Spelling mistake... Pin
Albert Pascual17-May-04 5:31
sitebuilderAlbert Pascual17-May-04 5:31 
GeneralRe: Spelling mistake... Pin
AORD18-May-04 20:45
AORD18-May-04 20:45 
GeneralRe: Spelling mistake... Pin
Vadim Tabakman19-May-04 0:19
Vadim Tabakman19-May-04 0:19 
GeneralOutlook and others Pin
Paul Watson15-May-04 2:01
sitebuilderPaul Watson15-May-04 2:01 
GeneralRe: Outlook and others Pin
Albert Pascual19-May-04 5:33
sitebuilderAlbert Pascual19-May-04 5:33 
Actually, I tested the program sending emails to Outlook 2003 out of the box. Outlook will load the HTML and make the request to the server. However if the images are attached will not load them until you ask for them.

Albert
GeneralRe: Outlook and others Pin
Paul Watson19-May-04 5:39
sitebuilderPaul Watson19-May-04 5:39 
GeneralRe: Outlook and others Pin
Albert Pascual1-Aug-05 8:05
sitebuilderAlbert Pascual1-Aug-05 8:05 

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.