public async Task <IActionResult> ForgotPassword(LoginViewModel model) { if (model.Email != string.Empty && model.Email != null) { var record = await this.userDetailService.GetPassword(model.Email); if (record != null) { var htmlBody = string.Empty; var filePath = Path.Combine(this.hostingEnvironment.WebRootPath + "/Templates/", "Forgotpassword.html"); using (StreamReader sourceReader = System.IO.File.OpenText(filePath)) { htmlBody = await sourceReader.ReadToEndAsync(); htmlBody = htmlBody.Replace("##HOSTURL##", this.domainSetting.WebSiteUrl); htmlBody = htmlBody.Replace("##password##", record.Password); htmlBody = htmlBody.Replace("##User##", record.FirstName); } var subject = "Your Acount Login Password"; SendMail.MailSend(subject, htmlBody, record.EmailId.Trim()); this.ShowMessage(Messages.ForgotPassword, Enums.MessageType.Success); } else { this.ShowMessage(Messages.InvalidUser, Enums.MessageType.Error); } } return(this.RedirectToAction("index", "user")); }
public async Task <IActionResult> ActivateUser(string user) { user = this.Base64Decode(user); if (user != string.Empty && user != null) { var record = await this.userDetailService.ActivateUser(Convert.ToInt32(user)); if (record != null) { var htmlBody = string.Empty; var filePath = Path.Combine(this.hostingEnvironment.WebRootPath + "/Templates/", "ActivateAccount.html"); using (StreamReader sourceReader = System.IO.File.OpenText(filePath)) { htmlBody = await sourceReader.ReadToEndAsync(); htmlBody = htmlBody.Replace("##HOSTURL##", this.domainSetting.WebSiteUrl); htmlBody = htmlBody.Replace("##User##", record.FirstName); } var subject = "Activation status from Luxury Travel Deals"; SendMail.MailSend(subject, htmlBody, record.EmailId.Trim()); this.ShowMessage(Messages.AccountActivation); } else { return(this.RedirectToAction("index", "home")); } } return(this.View()); }
/// <summary> /// Requests the call back. /// </summary> /// <param name="model">The model.</param> /// <returns>view</returns> public async Task <IActionResult> RequestCallBack(RequestCallBackViewModel model) { if (this.ModelState.IsValid) { var jj = model.BestTimeToCall.ToDisplayName(); var htmlBody = string.Empty; var filePath = Path.Combine(this.hostingEnvironment.WebRootPath + "/Templates/", "RequestCallBack.html"); var currentUrl = this.HttpContext.Request.Host.ToString().ToLower(); using (StreamReader sourceReader = System.IO.File.OpenText(filePath)) { htmlBody = await sourceReader.ReadToEndAsync(); htmlBody = htmlBody.Replace("##HOSTURL##", this.domainSetting.WebSiteUrl); htmlBody = htmlBody.Replace("##Name##", model.Name); htmlBody = htmlBody.Replace("##Phone##", model.Mobile); htmlBody = htmlBody.Replace("##Email##", model.Email); htmlBody = htmlBody.Replace("##BestTime##", model.BestTimeToCall.ToDisplayName()); htmlBody = htmlBody.Replace("##RequestFrom##", model.PageUrl); } var subject = "Request to call back"; SendMail.MailSend(subject, htmlBody, Constants.RequestCallBackAdminEmail); ////return this.Json(new { Status = true, Message = Messages.Requestcallback }); return(this.View("thankyou")); } return(this.Json(new { Status = false, Message = "Invalid" })); }
public async Task <IActionResult> ContactUs(string conemail, string confullname, string conarea, string conphone) { if (!string.IsNullOrEmpty(conemail) && !string.IsNullOrEmpty(confullname) && !string.IsNullOrEmpty(conarea) && !string.IsNullOrEmpty(conphone)) { var htmlBody = string.Empty; var filePath = Path.Combine(this.hostingEnvironment.WebRootPath + "/Templates/", "Feedback.html"); var currentUrl = this.HttpContext.Request.Host.ToString().ToLower(); using (StreamReader sourceReader = System.IO.File.OpenText(filePath)) { htmlBody = await sourceReader.ReadToEndAsync(); htmlBody = htmlBody.Replace("##HOSTURL##", this.domainSetting.WebSiteUrl); htmlBody = htmlBody.Replace("##Name##", confullname); htmlBody = htmlBody.Replace("##Email##", conemail); htmlBody = htmlBody.Replace("##Phone##", conphone); htmlBody = htmlBody.Replace("##Feedback##", conarea); } var subject = "Share Feedback"; SendMail.MailSend(subject, htmlBody, Constants.RequestCallBackAdminEmail); return(this.Json(new { Status = true, Message = "Sent successfully" })); } return(this.Json(new { Status = false, Message = "Invalid" })); }
public async Task <IActionResult> Register(RegisterViewModel model, string returnUrl = null) { ViewData["ReturnUrl"] = returnUrl; SendMail objmail = new SendMail(); string apiKey = _configuration.GetSection("Appsettings").GetSection("Apikey").Value; if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.Email, Email = model.Email, PhoneNumber = model.PhoneNumber, EmailConfirmed = true, UserType = model.UserType, FirstName = model.FirstName, LastName = model.LastName }; var result = await _userManager.CreateAsync(user, model.Password); if (result.Succeeded) { _logger.LogInformation("User created a new account with password."); var test = objmail.MailSend(model.Email, apiKey); await _signInManager.SignInAsync(user, isPersistent : false); _logger.LogInformation("User created a new account with password."); return(RedirectToLocal(returnUrl)); } AddErrors(result); //var test1 = objmail.MailSend(model.Email, apiKey); } return(RedirectToLocal(returnUrl)); }
public bool EmailExits(string email) { if (_manager.Find(r => r.Email == email.ToLower()) != null) { User user = _manager.Find(r => r.Email == email.ToLower()); string content = "Parolanızı değiştirmek için aşağıdaki linke tıklayınız.\r\n\r\n" + "http://www.hikayecimatik.com/NewPassword/" + user.SecurityGuid.ToString(); SendMail.MailSend(email, "Parola Değiştirme", content); return(true); } return(false); }
public async Task <IActionResult> SendLead(string first_Name, string last_Name, string email, string mobile, string phone, int no_Of_Pax, int no_Of_Nights, int no_of_Rooms, int no_of_Adult, int no_of_Children, int no_of_Infant, int dealId, string startDate, string endDate) { bool mailStatus = false; if (!string.IsNullOrEmpty(email)) { DateTime dealStart = DateTime.Parse(startDate); DateTime dealEnd = DateTime.Parse(endDate); SendLeadViewModel sendLeadViewModel = await this.dealService.GetSendDealinfo(dealId); sendLeadViewModel.SiteUrl = this.domainSetting.WebSiteUrl; sendLeadViewModel.LeadName = first_Name; sendLeadViewModel.first_Name = first_Name; sendLeadViewModel.last_Name = last_Name; sendLeadViewModel.email = email; sendLeadViewModel.mobile = mobile; sendLeadViewModel.phone = phone; sendLeadViewModel.no_Of_Pax = no_Of_Pax; sendLeadViewModel.no_Of_Nights = Convert.ToInt32((dealEnd - dealStart).TotalDays); sendLeadViewModel.no_of_Rooms = no_of_Rooms; sendLeadViewModel.no_of_Adult = no_of_Adult; sendLeadViewModel.no_of_Children = no_of_Children; sendLeadViewModel.no_of_Infant = no_of_Infant; sendLeadViewModel.dealId = dealId; sendLeadViewModel.startDate = dealStart; sendLeadViewModel.endDate = dealEnd; var result = await this.viewRenderService.RenderToStringAsync("MailTemplate/_SendLead", sendLeadViewModel); var subject = Constants.BookingMailSubject; mailStatus = SendMail.MailSend(subject, this.Content(result).Content, email); } else { return(this.Json(new { Status = false, Message = "Email id wrong." })); } if (mailStatus) { return(this.Json(new { Status = true, Message = "Success" })); } else { return(this.Json(new { Status = false, Message = "Failed" })); } }
private void SendEmailToAdmin(string fullErrorMessage) { var emailToText = ConfigurationManager.AppSettings["EmailAlertSystemError"]; var emailTo = emailToText.Split(',').ToList(); List <MailProfile> mailTo = new List <MailProfile>(); for (int i = 0; i < emailTo.Count(); i++) { MailProfile mail = new MailProfile() { MailAddress = emailTo.ElementAt(i) }; mailTo.Add(mail); } SendMailMessage message = new SendMailMessage(); message.emailFrom = ConfigurationManager.AppSettings["From"]; message.emailFromDisplayName = ConfigurationManager.AppSettings["FromName"]; message.emailTo = mailTo; message.emailSubject = "Subject"; message.emailBody = fullErrorMessage; int intSendMailType; intSendMailType = int.Parse(ConfigurationManager.AppSettings["SmtpType"]); switch (intSendMailType) { case 1: message.sendBy = SendMailMessage.SendByEnum.BrinksSmtp; message.smtpServer = ConfigurationManager.AppSettings["SmtpServer"]; break; } SendMail sendMail = new SendMail(); sendMail.MailSend(message); }
/// <summary> /// Envoi du mail /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { string newMDP = send.MailSend(txbMailTo.Text); model.TryUpdateMDP(newMDP); }
public async Task <IActionResult> SignUpOtp(UserDetailViewModel model) { var userRecord = await this.userDetailService.LoginOTPAsync(model.MobileNo, model.OTP, true); if (userRecord == null) { var record = this.mapper.Map <UserDetailModel>(model); await this.userDetailService.DeleteAsync(record); var result = new { Status = false, Message = Messages.InvalidOtp }; return(this.Json(result)); } else { var userDeatils = await this.userDetailService.GetByIdAsync(userRecord.Id); if (userDeatils != null) { userDeatils.IsActive = true; var updateDeatils = await this.userDetailService.UpdateAsync(userDeatils); string uri = "https://luxurytravel.deals/"; var msg = userDeatils.FirstName + ", welcome aboard to happiness! Your account has been created with Luxury Travel Deals. You can access your account/bookings in this link: " + Environment.NewLine + @uri; await this.SendSms(userDeatils.MobileNo.ToString(), msg); if (userDeatils.EmailId != null && userDeatils.EmailId != string.Empty) { var htmlBody = string.Empty; var filePath = Path.Combine(this.hostingEnvironment.WebRootPath + "/Templates/", "Registration_emailer.html"); using (StreamReader sourceReader = System.IO.File.OpenText(filePath)) { htmlBody = await sourceReader.ReadToEndAsync(); htmlBody = htmlBody.Replace("##HOSTURL##", this.domainSetting.WebSiteUrl); htmlBody = htmlBody.Replace("##User##", userDeatils.FirstName); htmlBody = htmlBody.Replace("##BlobUrl##", this.configuration.GetValue <string>("AzureBlobAppSetting:ImageInitializer") + "/"); } var subject = "Account Creation - Luxury Travel Deals"; SendMail.MailSend(subject, htmlBody, userDeatils.EmailId.Trim()); } var result = new { Status = true, Message = Messages.RegisterSuccessfull, Id = userRecord.Id }; return(this.Json(result)); } else { var result = new { Status = false }; return(this.Json(result)); } } }