Exemple #1
0
        private string CraeteConactUsMailBody(ContatusModel model)
        {
            string strEmailBody = "";

            strEmailBody += "Inquery Time: ";
            strEmailBody += DateTime.Now.ToString();
            strEmailBody  = strEmailBody + Environment.NewLine + Environment.NewLine;

            strEmailBody += "Full Name: ";
            strEmailBody += model.FName + " " + model.LName;
            strEmailBody  = strEmailBody + Environment.NewLine + Environment.NewLine;

            strEmailBody += "Your Email: ";
            strEmailBody += model.Email;
            strEmailBody  = strEmailBody + Environment.NewLine + Environment.NewLine;

            strEmailBody += "Your Phone: ";
            strEmailBody += model.Phone;
            strEmailBody  = strEmailBody + Environment.NewLine + Environment.NewLine;
            strEmailBody  = strEmailBody + Environment.NewLine + Environment.NewLine;

            strEmailBody += "Message: ";
            strEmailBody += model.Message;
            strEmailBody  = strEmailBody + Environment.NewLine + Environment.NewLine;
            strEmailBody  = strEmailBody + Environment.NewLine + Environment.NewLine;

            return(strEmailBody);
        }
Exemple #2
0
 public ActionResult ContactUs(ContatusModel model)
 {
     if (ModelState.IsValid)
     {
         MailMessage mail   = new MailMessage("*****@*****.**", "*****@*****.**");
         SmtpClient  client = new SmtpClient("mail.signinnhotels.com", 25);
         // client.EnableSsl = true;
         client.UseDefaultCredentials = false;
         client.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "Noreply@123");
         mail.Subject = "Book My Hotel";
         mail.Body    = CraeteConactUsMailBody(model);
         try
         {
             client.Send(mail);
         }
         catch (Exception ex)
         {
         }
     }
     return(View());
 }