public void InformSubscriber(int offerId) { Offer offer = repo.GetWithRestaurantDetails(offerId); foreach (var item in this.subRepo.GetAll()) { MailMessage mm = new MailMessage("*****@*****.**", item.SubscriberMail.Trim()); mm.Subject = "New Offer Posted"; mm.Body = string.Format("Hi ,<br /><br />New Offer given by {0} Restaurant.<br />Item Name:{1}<br />Price:{2}<br />For More Info click <a href='http://localhost:65526/offer/Details/{3}'><a/>{3}<br />Thank You.", offer.Restaurant.RestaurantName, offer.ItemName, offer.Price, offer.OfferId); mm.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.EnableSsl = true; NetworkCredential NetworkCred = new NetworkCredential(); NetworkCred.UserName = "******"; NetworkCred.Password = "******"; smtp.UseDefaultCredentials = true; smtp.Credentials = NetworkCred; smtp.Port = 587; smtp.Send(mm); } }