Пример #1
0
        public ActionResult ForgotPassword(ForgotPasswordmodel model)
        {
            var customer = CustomerService.GetCustomerByEmail(model.Email);

            if (customer == null)
            {
                ViewBag.error = "You are not registered yet";
                return(View(model));
            }
            var    url     = string.Format("/Account/ResetPassword/{0}", customer.ActivationCode);
            var    link    = Request.Url.AbsoluteUri.Replace(Request.Url.PathAndQuery, url);
            string subject = "Forgot Password ";
            string header  = EmailBody.MailHeader(subject, LinkedInDemo.Class.AdminSiteConfiguration.GetURL());
            string footer  = EmailBody.MailFooter(LinkedInDemo.Class.AdminSiteConfiguration.CompanyEmail);
            string body    = "<tr>";

            body = body + "<td style='text-align:left; padding: 0px 30px;'>";
            body = body + "<p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000;'>  Dear User, </p>";
            body = body + "<p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000; line-height: 22px;'> Please click on the following link in order to reset your account password.</p>";
            body = body + "<p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000;'><a href='" + link + "' style='text-decoration: none; color: #d21180;'> Forgot Password ! </a></p><br />";
            body = body + "<p style='margin: 0px; padding: 0px 0px 0px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000; line-height: 22px;'><b>Cheers,</b> <br />" + LinkedInDemo.Class.AdminSiteConfiguration.SiteName + " Team</p>";
            body = body + "</td></tr>";

            //body = body + "<p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000;'><a href='" + link + "'> Forgot Password ! </a>";
            //body = body + "</p><br/>";
            //body = body + "<p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000; line-height: 22px;'>Cheers, <br />" + LinkedInDemo.Class.AdminSiteConfiguration.SiteName + " Team</p>";

            string mailbody = header + body + footer;

            SendMailService.SendMail(model.Email, subject, mailbody);
            ViewBag.success = "Password reset link sent";
            return(View(model));
        }
Пример #2
0
        public async Task <IActionResult> QuenMatKhau(QuenMatKhauRequest request)
        {
            int    result          = 0;
            string newPassword     = SendMailService.GenerateString();
            string newHashPassword = BCryptService.HashPassword(newPassword);

            result = await _userService.QuenMatKhau(request.tenDangNhap, request.email, newHashPassword);

            if (result == 1)
            {
                var           subject = "Xác nhận quên mật khẩu";
                StringBuilder body    = new StringBuilder();
                body.AppendFormat("Mật khẩu mới của bạn là: {0}", newPassword);

                try
                {
                    var message = SendMailService.InitEmailMessage(request.email, subject, body.ToString());
                    SendMailService.SendMail(message);
                    return(Ok(result));
                }
                catch (Exception ex)
                {
                    return(StatusCode(500));
                }
            }

            return(NotFound());
        }
Пример #3
0
 public void directcreditbyadmin(int CustomerId, string firstname, decimal ordertotal)
 {
     try
     {
         var    subject = " Credits added to your account. ";
         var    cust    = CustomerService.GetCustomerById(CustomerId);
         var    Email   = cust.Email;
         var    url     = string.Format("/Dashboard/");
         var    link    = Request.Url.AbsoluteUri.Replace(Request.Url.PathAndQuery, url);
         string header  = EmailBody.MailHeader(subject, LinkedInDemo.Class.AdminSiteConfiguration.GetURL());
         string footer  = EmailBody.MailFooter(LinkedInDemo.Class.AdminSiteConfiguration.CompanyEmail);
         string body    = "<tr>";
         body = body + "<td style='text-align:left; padding: 0px 30px;'>";
         body = body + "<p>Dear User,";
         body = body + " " + ordertotal + " Credits is added to your account.<br/>Visit your dashboard to check and use these credits for your events.</p>";
         body = body + "<a href='" + link + "'><button> Go To Dashboard </button></a><br/>";
         body = body + "If you have any queries, please email us on [email protected].<br/>";
         body = body + "Thank you for using EventNX.";
         body = body + "</td></tr>";
         string mailbody = header + body + footer;
         SendMailService.SendMail(Email, subject, mailbody);
     }
     catch (Exception ex)
     {
     }
 }
Пример #4
0
 public ActionResult ForgotUserPassoword()
 {
     SendMailService.SendMail(new Models.Email {
         Message = "Ninh dep trai",
         Subject = "this is subject",
         ToEmail = "*****@*****.**",
         ToName  = "Ninh"
     });
     return(Ok());
 }
Пример #5
0
 public IHttpActionResult SendEmail(SendMailRequest mailModel)
 {
     try
     {
         SendMailService sendMailService = new SendMailService();
         sendMailService.SendMail(mailModel);
         return(Ok("Mail Sent"));
     }
     catch (ObjectDisposedException ex)
     {
         throw ex;
     }
 }
Пример #6
0
        // send mail reset password
        public void sendMailResetPassword(string UserEmail)
        {
            SendMailService sendMailservice = new SendMailService();
            string          content         = System.IO.File.ReadAllText(Server.MapPath("~/Views/Common/ResetPassword.cshtml"));

            content = content.Replace("{{UserEmail}}", UserEmail);
            string subject     = "Xác nhận thiết lập mật khẩu";
            var    callbackUrl = Url.Action("ConfirmResetPassword", "UserAccount", new { UserEmail = UserEmail }, protocol: Request.Url.Scheme);

            content = content.Replace("{{callback}}", callbackUrl);

            sendMailservice.SendMail(UserEmail, subject, content); // Gửi email đến tài khoản đăng kí
        }
Пример #7
0
        // send email confirm account
        public void sendMailRegisterAccount(UserAccountModel model)
        {
            SendMailService sendMailservice = new SendMailService();
            string          content         = System.IO.File.ReadAllText(Server.MapPath("~/Views/Common/Sendmail.cshtml"));

            content = content.Replace("{{UserEmail}}", model.USER_EMAIL);
            content = content.Replace("{{UserName}}", model.USER_NAME);
            content = content.Replace("{{Phone}}", model.USER_PHONE);
            string subject     = "Xác nhận tài khoản mới";
            var    callbackUrl = Url.Action("ConfirmEmail", "UserAccount", new { UserEmail = model.USER_EMAIL }, protocol: Request.Url.Scheme);

            content = content.Replace("{{callback}}", callbackUrl);
            //var toEmail = ConfigurationManager.AppSettings["ToEmailAddress"].ToString();
            //sendMailservice.SendMail(toEmail, subject, content);
            sendMailservice.SendMail(model.USER_EMAIL, subject, content); // Gửi email đến tài khoản đăng kí
        }
Пример #8
0
        public ActionResult Send(SendRequestModel request)
        {
            var response = new SendResponseModel();

            //try to send email and make appropriate json object if not.

            response.Errors.AddRange(SendMailService.SendMail(request));

            if (!response.Errors.Any())
            {
                response.Message = "Email sent successfully. We will respond ASAP!</p><br><p>You will be redirected to the home page shortly.";
            }

            return(Json(response));
            //? Json(new { status = "success", Message = "<p>Email sent successfully. We will respond ASAP!</p><br><p>You will be redirected to the home page shortly.</p><br>" })
            //: Json(new { status = "error", Message = "<p>Error sending email.</p><br><p> Please make sure your information is correct.</p>" });
        }
Пример #9
0
        public async Task <ActionResult <int> > DangKyTaiKhoanKhachHang(DangKyRequest request)
        {
            var result = 0;

            string maTaiKhoan = GenerateMaTaiKhoan(request.Sdt);

            string password     = SendMailService.GenerateString();
            string hashPassword = BCryptService.HashPassword(password);
            string soTaiKhoan   = GenerateSoTaiKhoan(request.Sdt);

            TaiKhoanDangNhapBO taiKhoanDangNhap = new TaiKhoanDangNhapBO();

            taiKhoanDangNhap.MaTaiKhoan     = maTaiKhoan;
            taiKhoanDangNhap.TenDangNhap    = request.TenDangNhap;
            taiKhoanDangNhap.MatKhau        = hashPassword;
            taiKhoanDangNhap.IdLoaiTaiKhoan = 1;

            TaiKhoanKhachHangBO taiKhoanKhachHang = new TaiKhoanKhachHangBO();

            taiKhoanKhachHang.MaTk        = maTaiKhoan;
            taiKhoanKhachHang.Sdt         = request.Sdt;
            taiKhoanKhachHang.Email       = request.Email;
            taiKhoanKhachHang.SoTaiKhoan  = soTaiKhoan;
            taiKhoanKhachHang.TenTaiKhoan = request.HoTen;
            taiKhoanKhachHang.SoDu        = 0;

            var themTaiKhoanResult = _userService.ThemTaiKhoanDangNhap(taiKhoanDangNhap);

            if (themTaiKhoanResult.Result == 1)
            {
                // Send mail after create success
                var           subject = "Đăng ký tài khoản";
                StringBuilder body    = new StringBuilder();
                body.AppendFormat("Mật khẩu của bạn là: {0}", password);
                var message = SendMailService.InitEmailMessage(request.Email, subject, body.ToString());
                SendMailService.SendMail(message);

                result = _userService.ThemThongTinTaiKhoanKhachHang(taiKhoanKhachHang).Result;
                return(result);
            }
            else
            {
                return(StatusCode(500));
            }
        }
Пример #10
0
        public JsonResult SendRecoveryPassword(string EMail)
        {
            try
            {
                int    longitud = 4;
                Guid   miGuid   = Guid.NewGuid();
                string token    = Convert.ToBase64String(miGuid.ToByteArray());
                token = token.Replace("=", "").Replace("+", "");
                token = token.Substring(0, longitud);

                if (MailService.IsEmail(EMail))
                {
                    EncryptPass = ServiceEncryp.Encryp(token);

                    DataTable recPass = UserService.SpRecoveryPassword(EMail, EncryptPass);

                    if (recPass.Rows[0][0].ToString() == "OK")
                    {
                        MailService.SendMail(EMail, "Recuperación de contraseña", "Nueva Contraseña: " + EncryptPass);
                    }
                    else
                    {
                        data.message = recPass.Rows[0][0].ToString();
                        data.status  = "error";
                        return(Json(data, JsonRequestBehavior.AllowGet));
                    }

                    data.message = recPass.Rows[0][0].ToString();
                }
                else
                {
                    data.message = "Se ha ingresado un email no valido";
                    data.status  = "error";
                    return(Json(data, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                data.message = ex.Message;
                data.status  = "error";
                return(Json(data, JsonRequestBehavior.AllowGet));
            }

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Пример #11
0
        public async Task <IActionResult> SendMailOTP(string email)
        {
            // Generate OTP
            var otp = SendMailService.GenerateOTP();

            var           subject = "[18HCB Banking] Mã xác nhận";
            StringBuilder body    = new StringBuilder();

            body.AppendFormat("Mã xác nhận của bạn là: {0}", otp);

            try
            {
                var message = SendMailService.InitEmailMessage(email, subject, body.ToString());
                SendMailService.SendMail(message);
                return(Ok(otp));
            } catch (Exception ex)
            {
                return(StatusCode(500));
            }
        }
Пример #12
0
        public ActionResult Index(ContactUsModel model)
        {
            string subject = " New Inquiry ";
            string header  = EmailBody.MailHeader(subject, LinkedInDemo.Class.AdminSiteConfiguration.GetURL());
            string footer  = EmailBody.MailFooter(LinkedInDemo.Class.AdminSiteConfiguration.CompanyEmail);
            string body    = "<tr>";

            body = body + "<td style='text-align:left; padding: 0px 30px;'>";
            body = body + "<p>  <b>Name :</b> " + model.Name + " </p>";
            body = body + "<p>  <b>Company :</b> " + model.Company + " </p>";
            body = body + "<p> <b>Designation :</b> " + model.Designation + " </p>";
            body = body + "<p> <b>Phone :</b>" + model.Phone + " </p>";
            body = body + "<p> <b>Email :</b>" + model.Email + " </p>";
            body = body + "<p> <b>Message : </b>" + model.Message + " </p>";
            body = body + "<p>Thanks and Cheers,<br />";
            body = body + "The Entire EventNX team </p>";
            string mailbody = header + body + footer;

            SendMailService.SendMail("[email protected],[email protected],[email protected]", subject, mailbody);
            return(View(model));
        }
Пример #13
0
        public JsonResult GetQuote(ContactUsModel model)
        {
            string subject = " New Inquiry for Credits ";
            string header  = EmailBody.MailHeader(subject, LinkedInDemo.Class.AdminSiteConfiguration.GetURL());
            string footer  = EmailBody.MailFooter(LinkedInDemo.Class.AdminSiteConfiguration.CompanyEmail);
            string body    = "<tr>";

            body = body + "<td style='text-align:left; padding: 0px 30px;'>";
            body = body + "<p>  <b>FullName :</b> " + model.FullName + " </p>";
            body = body + "<p>  <b>CompanyName :</b> " + model.CompanyName + " </p>";
            body = body + "<p> <b>PhoneNumber :</b>" + model.PhoneNumber + " </p>";
            body = body + "<p> <b>EmailAddress :</b>" + model.EmailAddress + " </p>";
            body = body + "<p> <b>CreditsRequired : </b>" + model.CreditsRequired + " </p>";
            body = body + "<p>Thanks and Cheers,<br />";
            body = body + "The Entire EventNX team </p>";
            string mailbody = header + body + footer;

            SendMailService.SendMail("[email protected],[email protected],[email protected]", subject, mailbody);
            //  return View(model);
            return(Json("Success", JsonRequestBehavior.AllowGet));
        }
Пример #14
0
        public void sendMailtoadmin(string firstname, string LastName, string CustEmail, string Contactno, string CompanyName, decimal ordertotal)
        {
            try
            {
                var    subject = "New Credit Request";
                var    Email   = db.Adminsettings.Select(a => a.Smtpusername).FirstOrDefault();
                string header  = EmailBody.MailHeader(subject, LinkedInDemo.Class.AdminSiteConfiguration.GetURL());
                string footer  = EmailBody.MailFooter(LinkedInDemo.Class.AdminSiteConfiguration.CompanyEmail);
                string body    = "<tr>";

                body = body + "<td style='text-align:left; padding: 0px 30px;'>";
                body = body + "<p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000; text-align:left;'>" + " " + firstname + " " + LastName + " " + "has requested" + " " + ordertotal + " " + " to credit.</p>";
                body = body + "<p style='margin: 0px; padding: 0px 0px 12px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000;'> User Details are :</p>";
                body = body + "<p style='margin: 0px; padding: 0px 0px 12px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000;'>" + CustEmail + " </p>";
                body = body + "<p style='margin: 0px; padding: 0px 0px 12px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000;'>" + Contactno + " </p>";
                body = body + "<p style='margin: 0px; padding: 0px 0px 12px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000;line-height: 22px;'>" + CompanyName + "</p>";
                string mailbody = header + body + footer;
                SendMailService.SendMail("[email protected],[email protected],[email protected]", subject, mailbody);
            }
            catch (Exception ex)
            {
            }
        }
Пример #15
0
        public void VerificationEmail(string firstname, string lastname, string email, string activationCode)
        {
            var url            = string.Format("/Account/ActivationAccount/{0}", activationCode);
            var companywebsite = AdminService.GetAdminSetting();
            var link           = companywebsite.CompanyWebsite + url;
            //var link = Request.Url.AbsoluteUri.Replace(Request.Url.PathAndQuery, url);
            string subject = "Please activate your EventNX account";
            string header  = EmailBody.MailHeader("Account Activation Email", LinkedInDemo.Class.AdminSiteConfiguration.GetURL());
            string footer  = EmailBody.MailFooter(LinkedInDemo.Class.AdminSiteConfiguration.CompanyEmail);
            string body    = "<tr>";

            body = body + "<td style='text-align:left; padding: 0px 30px;'>";
            body = body + "<p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000;'>  Hello " + firstname + " " + lastname + ",</p>";
            body = body + "<p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000;'>";
            body = body + "Welcome to EventNX!</p>";
            body = body + "<p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000; line-height: 22px;'>";
            body = body + "To activate your account, please click on the button below to verify your email address.</p>";
            body = body + "<p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000;'>";
            body = body + "<a href='" + link + "'><button style='background: #6F1855; color:#fff; border:none; padding:9px 20px; cursor: pointer;'> Activation Account ! </button></a></p>";
            body = body + "<p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000;'>Or paste this link intoyour browser:</ p > ";
            body = body + "<p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000; line-height: 22px;'>";
            body = body + "<a href='" + link + "' target='_blank' style='text-decoration: none; color: #d21180;'>" + link + "</p>";
            body = body + "<p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000; line-height: 22px;'>If you have any questions you can contact us at <a href='mailto:[email protected]' style='text-decoration: none; color: #d21180;'>[email protected]</a>.</ p > ";
            body = body + "<p style='margin: 0px; padding: 0px 0px 0px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000; line-height: 22px;'><b>Thanks and Cheers,</ b > <br />" + "The Entire EventNX team </p> ";
            body = body + "</td></tr>";
            //body = body + "<p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000;line-height: 22px;'>To activate your account, please click on the button below to verify your email address.</p>" + "  <p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000;'><a href='" + link + "'><button> Activation Account ! </button></a></p>";
            //body = body + "<p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000;'>Or paste this link into your browser:";
            //body = body + "</p><br/>";
            //body = body + " <p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000;'>" + link + "</p>";
            //body = body + "<br/>";
            //body = body + "<p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000; line-height: 22px;'>If you have any questions you can contact us at [email protected] </p>";
            //body = body + "<p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000; line-height: 22px;'>Thanks and Cheers, <br />" + "The Entire EventNX team </p>";
            //body = body + "</td></tr>";
            string mailbody = header + body + footer;

            SendMailService.SendMail(email, subject, mailbody);
        }
Пример #16
0
        public void sendMailtocustomer(String Email, string subject, string firstname, int EventId, int amount)
        {
            try
            {
                EventMaster eventmaster = EventService.GetEventById(Convert.ToInt32(EventId));
                //Email = db.Adminsettings.Select(a => a.Smtpusername).FirstOrDefault();
                string header = EmailBody.MailHeader(subject, LinkedInDemo.Class.AdminSiteConfiguration.GetURL());
                string footer = EmailBody.MailFooter(LinkedInDemo.Class.AdminSiteConfiguration.CompanyEmail);
                string body   = "<tr>";

                body = body + "<td style='text-align:left; padding: 0px 30px;'>";
                body = body + "<p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000;'> Dear User,</p>";
                //body = body + "<p style='text-align:left; padding: 0px 30px;'>Your credit request has been accepted for event " + eventmaster.EventName + ".</p>";
                body = body + "<p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000;line-height: 22px;'>Your request for " + amount + " credits have been received. We will get in touch with you shortly to address this request. Please look for our email on " + Email + " </p>";
                body = body + "<p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000;line-height: 22px;'>If you have any queries, please email us on [email protected]. </p>";
                body = body + "<p style='margin: 0px; padding: 0px 0px 0px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000; line-height: 22px;'><b>Thanks and Cheers,</b><br />The Entire EventNX team </p>";

                string mailbody = header + body + footer;
                SendMailService.SendMail(Email, subject, mailbody);
            }
            catch (Exception ex)
            {
            }
        }