Click here to Skip to main content
6,596,602 members and growing! (19,930 online)
Email Password   helpLost your password?
Web Development » ASP.NET » General     Beginner

Email Tracker

By Albert Pascual

Track the emails you sent to people and you'll get alerted when somebody opens the email. Are spammers using this kind of tracking?
C++, C#, .NET, Win2K, WinXP, Win2003, ASP.NET, Visual Studio, MFC, Dev
Posted:13 May 2004
Views:122,663
Bookmarked:50 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
18 votes for this article.
Popularity: 4.63 Rating: 3.69 out of 5
1 vote, 5.6%
1
4 votes, 22.2%
2
1 vote, 5.6%
3
1 vote, 5.6%
4
11 votes, 61.1%
5

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)

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:

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

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

About the Author

Albert Pascual


Member
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
Occupation: Web Developer
Location: United States United States

Other popular ASP.NET articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 25 of 36 (Total in Forum: 36) (Refresh)FirstPrevNext
Generaleffort tracking system code in ASP.NET with c# PinmemberSriamar20:10 7 Apr '08  
QuestionE mail tracker source code Pinmemberprasadtalla2:46 9 May '07  
QuestionCaught by mail scanner PinmemberNirav K Sarvaiya4:20 16 Nov '05  
AnswerRe: Caught by mail scanner PinmemberAlbert Pascual5:51 16 Nov '05  
QuestionRe: Caught by mail scanner PinmemberNirav K Sarvaiya6:14 16 Nov '05  
GeneralThe other way around PinsussAnonymous3:40 30 Sep '05  
GeneralEmail tracking is not so easy Pinsussinanc_gumus2:02 20 May '04  
GeneralRe: Email tracking is not so easy Pinmembermartininick11:55 10 Jun '04  
GeneralRe: Email tracking is not so easy PinmemberEEmadzadeh18:49 29 Jul '05  
GeneralRe: Email tracking is not so easy PinmemberWcohen18:03 6 Sep '05  
Generalwow.. PinmemberMorningZ4:22 19 May '04  
GeneralRe: wow.. PinmemberAORD21:15 19 May '04  
GeneralRe: wow.. PinmemberMorningZ4:32 20 May '04  
GeneralRe: wow.. PinmemberAlbert Pascual6:57 20 May '04  
GeneralRe: wow.. PinmemberAORD15:52 20 May '04  
GeneralRe: wow.. Pinmemberpvialoux0:09 24 May '04  
GeneralSource Code PinmemberTony Bermudez8:51 17 May '04  
GeneralRe: Source Code PinmemberAlbert Pascual8:53 17 May '04  
GeneralRe: Source Code PinmemberRogerio P12:38 22 May '04  
GeneralRe: Source Code PinmemberAlbert Pascual6:54 24 May '04  
GeneralRe: Source Code Pinmemberzealcione7:23 23 May '04  
GeneralRe: Source Code Pinmemberreppin11:33 28 Apr '07  
GeneralRe: Source Code PinadminChris Maunder9:27 24 May '04  
GeneralRe: Source Code PinmemberAlbert Pascual9:41 24 May '04  
GeneralRe: Source Code Pinmemberzealcione15:17 24 May '04  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 13 May 2004
Editor: Chris Maunder
Copyright 2004 by Albert Pascual
Everything else Copyright © CodeProject, 1999-2009
Web18 | Advertise on the Code Project