コード例 #1
0
        public ActionResult SaveToDb(TAC_ContactUs contact)
        {
            contact.ContactId  = Guid.NewGuid();
            contact.PostedDate = DateTime.Now;
            db.TAC_ContactUs.Add(contact);
            db.SaveChanges();
            ViewBag.Message = "Your comment has been saved successfully!";
            HelperClasses.SendEmail obj = new HelperClasses.SendEmail();
            StringBuilder           sb  = new StringBuilder();

            sb.Append("<b>Dear Admin</b>, <br/>");
            sb.Append("A contact has just visited our site. Here are the details <br/><br/>");
            sb.Append("<b>Contact Name</b> : " + contact.Name + "<br/>");
            sb.Append("<b>Contact ID : </b>" + contact.ContactId + "<br/>");
            sb.Append("<b>Contact Email : </b>" + contact.Email + "<br/>");
            sb.Append("<b>Contact Comment : </b>" + contact.Comment + "<br/>");
            sb.Append("<b>Posted Date : </b>" + contact.PostedDate + "<br/>");
            obj.SendEmailMessage(GetAdminEmails(), sb.ToString(), "Contact Details");
            return(View("Contact", contact));
        }
コード例 #2
0
        public void SendMail(TAC_User user)
        {
            try
            {
                StringBuilder sbEmailBody = new StringBuilder();
                sbEmailBody.Append("Dear " + user.First_Name + ",<br/><br/>");
                sbEmailBody.Append("Please click on the following link to activate your account");
                sbEmailBody.Append("<br/>");
                sbEmailBody.Append("http://www.taclassifieds.com/Register/ConfirmMail?UID=" + user.UserId);
                sbEmailBody.Append("<br/><br/>");
                sbEmailBody.Append("<b>TechAspect Solutions</b>");

                HelperClasses.SendEmail obj = new HelperClasses.SendEmail();
                obj.SendEmailMessage(user.Email, sbEmailBody.ToString(), "Account Activation");
            }
            catch (Exception ex)
            {
                ViewBag.ErrorMessagee = "Technical Problem while sending an confirmation Email. Please try again.";
            }
        }