Hi all , Thanks for the codes sent to me on how to retrieve fields from an oracle database, i found them working and usefull . , bur what i however left out is that i need to email the values of some of these fields to a particlar recipient
' Please how do i achieve this ?
Thanks Much appreciated
Chinedu Nwankwo

Ramesh MaruthiPosted Oct 24, 2014, 1:13 PM
if so look a this code once and follow the below links :
http://www.aspdotnet-suresh.com/2012/09/how-to-send-gridview-in-email-body-in.html
http://www.dotnetsharepoint.com/2013/10/how-to-send-gridview-data-in-email-in.html#.VEqH7ckhtv4
protected void SendEmail(object sender, EventArgs e)
{
using (StringWriter sw = new StringWriter())
{
using (HtmlTextWriter hw = new HtmlTextWriter(sw))
{
GridView1.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
MailMessage mm = new MailMessage("[email protected]", "[email protected]");
mm.Subject = "GridView Email";
mm.Body = "GridView:
" + sw.ToString(); ;
mm.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential();
NetworkCred.UserName = "[email protected]";
NetworkCred.Password = "
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 587;
smtp.Send(mm);
}
}
}