Monday, May 6, 2013

Email Tracking using ASP.NET


We have many more ways to advertise a business or a product. But one of main way is Email through advertisement.
However, how many users opened their advertisement emails or newsletter emails. So we needs the opened email counts. In this article describes, how can we count the opened email?
   public void SendMail()
   {
       string toEmail = "abiice.1987@gmail.com";
       System.Net.Mail.MailMessage eMail = new System.Net.Mail.MailMessage();
       eMail.From = new System.Net.Mail.MailAddress("test@test.com");
       eMail.To.Add(toEmail);
       eMail.Subject = "test track";
       eMail.IsBodyHtml = true;
eMail.Body = "test body<IMG height=1       src='http://localhost:12207/EmailTrack/emailtrack.aspx?emailsent='"+toEmail+"'   width=1>";
       System.Net.Mail.SmtpClient SMTP = new System.Net.Mail.SmtpClient();
       SMTP.Send(eMail);
       eMail.Dispose();

    }

The above code describes the, how to send an email through Asp.Net. We needs Track the email so we could append an image inside the email body and we add a query string value to the SRC attribute. The query string helps to identify the user.
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack == false)
        {
            if (Request.Params["emailsent"] != null)
            {
            }
        }
    }
Then user open an email the request comes to web server and we get a querystring values and maintain the counts using database


4 comments:

  1. Is this code work for gmail users

    ReplyDelete
  2. This content is very informative and well organized. The practical tips mentioned are especially helpful for readers. Thanks for sharing these ideas with us.service now admin course

    ReplyDelete
  3. Excellent content! Our MongoDB online learning program offers expert-led sessions, practical labs, and job-oriented training for IT professionals.mongodb learn online

    ReplyDelete
  4. Great insights shared! Learning data architecture, normalization, and database design techniques helps learners build a strong foundation in data management through data modeling course.

    ReplyDelete