Send Mail Code : -
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Net.Mail;
///
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Net.Mail;
///
///
{
static string IP, UserName, Pwd;
public MailSending()
{
//
// TODO: Add constructor logic here
//
}
public static void SendMail(string To, string Subject, string Body)
{
IP = ConfigurationManager.AppSettings["IP"].ToString();
UserName = ConfigurationManager.AppSettings["UserName"].ToString();
Pwd = ConfigurationManager.AppSettings["Pwd"].ToString();
MailMessage message = new MailMessage("test@infosource.com", To, Subject, Body);
SmtpClient smtpClient = new SmtpClient(IP);
message.IsBodyHtml = true;
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials = new System.Net.NetworkCredential(UserName, Pwd);
smtpClient.Send(message);
}
}
Fill grid through Linq
private void FillGrid()
{
DASEntities dasEnt=new DASEntities();
var query =
from c in dasEnt.Users
select new { c.Id,c.Name,c.Age};
Dgv1.DataSource = query.ToList();
Dgv1.DataBind();
}
}
No comments:
Post a Comment