string connString = "Data Source=localhost\\sqlexpress;Initial Catalog=psspdb;Integrated Security=True";
string cmdText = "SELECT QuizID, IsSent FROM dbo.QUIZ where isnull(IsSent,0)=0";
string sLinkId = "";
using (SqlConnection conn = new SqlConnection(connString))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand(cmdText, conn))
{
SqlDataReader reader = cmd.ExecuteReader();
while (reader != null)
{
if (reader.Read())
{
string sQid = reader["QuizID"].ToString();
sLinkId += "<a href="http:
}
}
}
}
SmtpClient sc = new SmtpClient("MAIL ADDRESS");
MailMessage msg = null;
try
{
msg.To.Add("mailid1@gmial.com");
msg.To.Add("mailid2@gmial.com");
msg.To.Add("mailid3@gmial.com");
msg.From = new MailAddress("yourmailid@gmail.com");
msg.Subject = "Message from PSSP System";
msg.Body = "This Mail Send by System :" + sLinkId;
msg.IsBodyHtml = true;
sc.Send(msg);
}
catch (Exception ex)
{
throw ex;
}
finally
{
if (msg != null)
{
msg.Dispose();
}
}
Try This...