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
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 sender, EventArgs e)
{
Label1.ForeColor = System.Drawing.Color.Blue;
Label1.Text = "Ready";
}
protected void Button1_Click(object sender, EventArgs e)
{
string input = TextBox3.Text;
List<string> emails = 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;
}
}
}