-->

Wednesday, 15 October 2014

Mail Marketing Windows Form Project in C Sharp

Mail Marketing Windows Form Project in C Sharp

Project Description: This project is used to send bulk mails without spamming to promote your products and services. You can send thousands mail using this tool, all mailing address stored in local database and bind with dataGridView data control. Mail marketing or bulk mailing tool send one by one mail and pick mail address for datagridview which import mail addresses from local database. Mail marketing project created in .net framework 3.5 using c sharp language.

Mail Marketing Windows Form Project in C Sharp

Features of Mail Marketing Project:
  • Send thousands of mail on one click.
  • DataGridView Control to bind database on runtime.
  • Used local database to store mail addresses.
  • Protected for mass mailing or spamming.
  • Easy to manage controls and database.
  • Secure app.config file.
download
ProSoureCode:

To Bind Database:
  private void Form1_Load(object sender, EventArgs e)
        {
            DataTable dT;
            BindingSource bS;

            using (SqlCeConnection con = new SqlCeConnection("Data Source=|DataDirectory|\\Database1.sdf"))
            {
                dT = new DataTable();
                bS = new BindingSource();
                string query = "SELECT * FROM mailinglist";
                SqlCeDataAdapter dA = new SqlCeDataAdapter(query, con);
                SqlCeCommandBuilder cBuilder = new SqlCeCommandBuilder(dA);
                dA.Fill(dT);
                bS.DataSource = dT;
                dataGridView1.DataSource = bS;
            }
           
        }

To Send Mails:
   private void button1_Click(object sender, EventArgs e)
        {
            foreach (DataGridViewRow row in this.dataGridView1.Rows)
            {

                var email = row.Cells[2].Value.ToString();
        try
        {
            SmtpClient client = new SmtpClient("smtp.gmail.com");
            client.Port = 587;
            client.EnableSsl = true;
            client.Timeout = 100000;
            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            client.UseDefaultCredentials = false;
            client.Credentials = new NetworkCredential("your mail address", "your mail password");
            MailMessage msg = new MailMessage();
            msg.To.Add(email);
            msg.From = new MailAddress("your mail address");
            msg.Subject = textBox1.Text;
            msg.Body = richTextBox1.Text;
            client.Send(msg);
            MessageBox.Show("Successfully Sent Message.");
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
   
            }
        }

    
      
    }

Read other related articles

Also read other articles

© Copyright 2019 Project Source Code | All Right Reserved