protected void btn_Send_Click(object sender, EventArgs e) { Model1 ctx = new Model1(); Department d = ctx.Departments.Where(x => x.DeptName == lab_dept.Text).First(); string CollectionPoint = d.CollectionPoint; string a = Session["sign"].ToString(); User c = ctx.Users.Where(x => x.UserName == a).First(); string Sender = c.Email; List <User> receiver = ctx.Users.Where(x => x.Role == "StoreClerk").ToList(); string[] receive = new string[receiver.Count()]; for (int i = 0; i < receiver.Count(); i++) { receive[i] = receiver[i].Email.ToString(); } string Password = "******"; Session["Title"] = "CollectionPoint change Notification"; Session["content"] = Session["sign"].ToString() + ", who is from " + lab_dept.Text + " has changed the CollectionPoint, the new CollectionPoint is " + CollectionPoint + " ."; lab_dept.Text = SendEmail.sendEmail(Sender, Password, Session["Title"].ToString(), Session["content"].ToString(), receive); Session["Title"] = ""; Session["content"] = ""; Lab_successful.Text = "Email sent successful"; }