try
{
SmtpClient client = new SmtpClient();
client.Host = "smtp.gmail.com";
client.Port = 587;
client.Credentials = new NetworkCredential("gmail ID","password");
client.EnableSsl = true;
MailAddress from = new MailAddress("Gmail ID");
MailMessage msg = new MailMessage();
msg.From = from;
string s11 = "select Email ID from Table";
SqlDataAdapter add = new SqlDataAdapter(s11, c.getcon());
DataSet ds2 = new DataSet();
add.Fill(ds2);
if (ds2.Tables[0].Rows.Count != 0)
{
arra = new string[ds2.Tables[0].Rows.Count];
for (int i = 0; i < ds2.Tables[0].Rows.Count; i++)
{
arra[i] = System.Convert.ToString(ds2.Tables[0].Rows[i][0].ToString());
}
for (int i1 = 0; i1 < arra.Length; i1++)
{
msg.To.Add(arra[i1]);
msg.Subject = subject name;
msg.Body = body;
client.Send(msg);
Label3.Text = "Message Send Successfully";
}
}
}
catch(Exception e1)
{
}
Enjoy it...