how can I track emails in asp.net C#

Discussion in 'Help Desk' started by mtspy, Mar 19, 2013.

  1. mtspy

    mtspy Greylisted

    Joined:
    Mar 19, 2013
    Messages:
    4
    Likes Received:
    0
    I want to build a bulk email system for all people subscribed to my newsletter
    but I want to get statistics like
    who received the email
    who open it (if possible)
    and who on my list didn't receive it

    Kindly help

    my code

    PHP:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Net.Mail;

    public 
    partial class emailTest System.Web.UI.Page
    {
        protected 
    void Page_Load(object senderEventArgs e)
        {
            
    Label1.ForeColor System.Drawing.Color.Blue;
            
    Label1.Text "Ready";
        }
        protected 
    void Button1_Click(object senderEventArgs e)
        {

            
    string input TextBox3.Text;
            List<
    stringemails = new List<string>(
                                       
    input.Split(new string[] { "\n" },
                                       
    StringSplitOptions.RemoveEmptyEntries));
            
    string total emails.Count().ToString();
            
    int counter 0;

            try
            {

                foreach (
    string email in emails)
                {
                    
    SmtpClient smtpClient = new SmtpClient();
                    
    MailMessage message = new MailMessage();
                    try
                    {
                        
    MailAddress from = new MailAddress("noreply@example.net"TextBox1.Text);
                        
    message.From from;
                        
    message.To.Add(email);
                        
    message.Subject TextBox2.Text;
                        
    message.IsBodyHtml true;
                        
    message.Body Editor1.Content;
                        
    smtpClient.EnableSsl false;
                        
    message.BodyEncoding System.Text.Encoding.UTF8;
                        
    smtpClient.Send(message);
                        
    MessageBox.Show("email sent");
                        
    counter++;
                    }
                    catch (
    Exception ex)
                    {
                        
    Label1.ForeColor System.Drawing.Color.Red;
                        
    Label1.Text "FAIL in side loop" ex;
                        
    //throw ex;
                    
    }

                    

                }


                
    Label1.ForeColor System.Drawing.Color.Green;
                
    Label1.Text "Send successfully "+counter " of " total;
            }
            catch (
    Exception ex)
            {
                
    Label1.ForeColor System.Drawing.Color.Red;
                
    Label1.Text "FAIL" ex;
            }
        }
    }
     


  2. popowich

    popowich EQ Forum Admin Staff Member

    Joined:
    Aug 12, 2008
    Messages:
    8,983
    Likes Received:
    120
    Maybe there is a way to combine your programming with the Google Analytics API and some programming against your web site?

    Delivered emails you can get from your own logs.

    Received is not the same as delivered to me.

    Delivered is did the receiving mail server accept, vs received means you want to confirm it reached their inbox or other "not spam" folder?

    Open rate you can get from web site tracking links.
     

  3. mtspy

    mtspy Greylisted

    Joined:
    Mar 19, 2013
    Messages:
    4
    Likes Received:
    0
    :thanks:

    Thanx for your help
     

Want to reply or ask your own question?

It only takes a minute to sign up (and it's free!). Click the orange sign up button to choose a username and then you can ask your own questions on the forum.
Loading...