How to Send Bulk Email in with Example using C#

Category > ASP.NET || Published on : Sunday, July 6, 2014 || Views: 18881 || C#.Net SendMail VB.NET

In this article, I'm explaining how to send bulk email using ASP.NET and C#. The prerequisite to send bulk email we need list of Email Id's, whom we want to send emails.


Steps 1: Create a new web application and add a new html page, This html will be send as Email body









"-//W3C//DTD XHTML 1.0 Transitional//EN" "">

    HTML Template

UserName:$$UserName$$ PassWord: $$Password$$ Thanks


Step 2: Now in your Default.aspx page write the following code



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Data;
using System.Net.Mail;
namespace BulkEmail
    public partial class Default : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
    protected void BindGridviewData()
            DataTable dt = new DataTable();
            dt.Columns.Add("UserName", typeof(Int32));
            dt.Columns.Add("Password", typeof(string));
            dt.Rows.Add(1, "Raju", "");
            dt.Rows.Add(2, "Shyam", "");
            dt.Rows.Add(3, "Laxman", "");
            dt.Rows.Add(4, "kumar", "");
            gvDetails.DataSource = dt;
    protected void btnSend_Click(object sender, EventArgs e)
    foreach (GridViewRow grow in gvDetails.Rows)
    string strContactName = grow.Cells[1].Text.Trim();
    string strEmail = grow.Cells[2].Text.Trim();
                StreamReader reader = new StreamReader(Server.MapPath("~/Email.html"));
    string readFile = reader.ReadToEnd();
    string myString = readFile;
                myString = myString.Replace("$$UserName$$", strCon

Download Source Codes