Hi,
Try this.
If subject and body is same for all customer then see this.
string from = your registered mail;
string to = String.Empty;
string smpt = your smtp server;
string smptport = your smtp port;
DataTable dt =
string SmtpUser = your smtp user(can be same as from);
string SmtpPassword = your smtp user(email) password
int totalcountofcustomer = dt.Rows.Count;
for(int i=0;i<totalcountofcustomer;i++)>
{
to += dt.Rows[i]["CustomerEmail"] + ",";
}
to = to.Substring(0, to.Length - 1);
string subject = your mail subject;
string body = mail body;
MailMessage message = new MailMessage(from, to, subject, body);
message.IsBodyHtml = true;
SmtpClient smtpClient = new SmtpClient(smpt);
smtpClient.Port = Convert.ToInt32(smptport);
smtpClient.Credentials = new System.Net.NetworkCredential(SmtpUser, SmtpPassword);
smtpClient.EnableSsl = true;
message.ReplyToList.Add(from);
smtpClient.Send(message);
If subject and body is different on some in between logic, then see following.
DataTable dt =
int totalcountofcustomer = dt.Rows.Count;
string from = your registered mail;
string smpt = your smtp server;
string smptport = your smtp port;
string SmtpUser = your smtp user(can be same as from);
string SmtpPassword = your smtp user(email) password
for(int i=0;i<totalcountofcustomer;i++)>
{
string to = String.Empty;
to = dt.Rows[i]["CustomerEmail"];
string subject = your mail subject;
string body = mail body;
MailMessage message = new MailMessage(from, to, subject, body);
message.IsBodyHtml = true;
SmtpClient smtpClient = new SmtpClient(smpt);
smtpClient.Port = Convert.ToInt32(smptport);
smtpClient.Credentials = new System.Net.NetworkCredential(SmtpUser, SmtpPassword);
smtpClient.EnableSsl = true;
message.ReplyToList.Add(from);
smtpClient.Send(message);
}
Hope it helps you.
Thanks.