Tracking Emails - Know Whether the Recipient Opens it
It is very easy to track whether the user has read the email. The concept is very simple. You insert a link to a small transparent image in the mail sent, the mail being sent in HTML format, and when the user opens the email the image is loaded sending you a querystring to the web page that tracks the email. The web page requests the querystring or the parameter that is passed. This ensures that the email is read by the user.
When the page that is tracking is requested by the email sent you can get the value of the date and time when the request comes and you can store them in a database or send you an alert indicating the time and date at which the email was read by the user. This is the simple way that is used to track whether the emails sent are read or not.
To send emails you may be importing the namespace System.Web.Mail. You would be creating a MailMessage object as given below.
MailMessage mailMsg = new MailMessage();
The above code sends an email to an email address as given in the mailMsg.To property. For tracking an email, all you have to do is to add an image tag to the body of the message i.e. sBody. This can be done by
sBody = sBody + "<IMG height=1 src=\"http://www." + sYourDomain + "/trackemail.aspx?sentto=" + sParam + "\" width=1>";
In the above line sParam is the parameter that is passed to the url and sYourDomain is your domain name where you create this page to track the email. If you send an email with the body of the message as given above, when the user reads the email, the image tag will try to load the url given in the tag. This will send the parameter sentto that is given by you to the page requested. In the trackemail.aspx page you can write code to retrieve the value of the parameter sentto. Once you receive the parameter you can do anything on that page to indicate that the user has read the email.
The code given below can be used in the trackemail.aspx page to retrieve the parameter.
Page_Load(object sender, System.EventArgs e)
Once you have retrieved the parameter that is passed to the page you can redirect the request to a transparent image so that this transparent image, transparent.gif loads in the email message of the user who is reading the mail. Make this transparent.gif as small as possible, usually of 1 pixel by 1 pixel height and width, so that it does not take time to load. Since it is transparent the user who reads your mail may not know that an image has been loaded in the email message and the email that he reads is being tracked.
This way of tracking the email is so easy. Once you get the parameter in your trackemail.aspx page you can add a time stamp to the body of the email message that is sent to you in the Page_Load event of that page. This enables you to know the time and date at which the email was read by the user.
to our mailing list and receive new articles Note
: We never rent, trade, or sell my email lists to Visit
.NET Programming Tutorial Homepage ______________________________________________________
to our mailing list and receive new articles
: We never rent, trade, or sell my email lists to
Visit .NET Programming Tutorial Homepage