email sending codes

Posted by Smash_amit under C# on 2/13/2009 | Views : 1076 | Status : [Member] | Replies : 2
hiiii,
i hav windows application vich shows data in datagridview

now i hav a requirement of sending data shown in the datagridview...in an email.....in the same application.

plzz.tell me the codes to do that.....in c#....




Responses

Posted by: Majith on: 2/13/2009 [Member] Starter

Up
0
Down
Follow the below code,

using System.Web.Mail

//Finding Values fron Grid

TextBox ToValue= (TextBox)grdMail.Rows[0].FindControl("txtTo");
TextBox FromValue = (TextBox)grdMail.Rows[0].FindControl("txtFrom");
TextBox SubjectValue = (TextBox)grdMail.Rows[0].FindControl("txtSubject");
TextBox BodyValue = (TextBox)grdMail.Rows[0].FindControl("txtBody");

Public void SendMail()
{
//mak@dotnetfunda.Com
string _To = ToValue.Text;
//sak@dotnetfunda.com
string _From = FromValue .Text
//Hi
string _Subject = SubjectValue.Text;
//
string _Body = BodyValue.Text;

SmtpMail.Send(_To, _From, _Subject,_Body);


}

Smash_amit, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Chinnu21 on: 2/15/2009 [Member] Starter

Up
0
Down
sending email using system.net.mail

http://www.dotnetfunda.com/articles/article7.aspx


Smash_amit, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response