public ActionResult MailPost(string name, string email, string message) { GmailService.GmailUsername = "******"; GmailService.GmailPassword = "******"; GmailService mailer = new GmailService(); mailer.ToEmail = "*****@*****.**"; mailer.Subject = name; mailer.Body = "Gönderen: " + email + " \n\n İçerik \n " + message; mailer.IsHtml = false; mailer.Send(); return(RedirectToAction("Index")); }
//public ActionResult MailPost(string name, string email, string message) //{ // if (ModelState.IsValid) // { // try // { // var body = new StringBuilder(); // body.AppendLine("İsim: " + name); // body.AppendLine("Gönderen " + email); // body.AppendLine("Mesaj: " + message); // EmailHelper.MailSender(body.ToString(), name); // } // catch (Exception ex) // { // ViewData.ModelState.AddModelError("_HATA", ex.Message); // } // } // return RedirectToAction("Index"); //} public ActionResult MailPost(string name, string email, string message) { GmailService.GmailUsername = "******"; GmailService.GmailPassword = "******"; GmailService mailer = new GmailService(); mailer.ToEmail = "*****@*****.**"; mailer.Subject = name; mailer.Body = "Gönderen: " + email + " \n\n İçerik: \n " + message; mailer.IsHtml = false; mailer.Send(); return(RedirectToAction("Anasayfa")); }
private string SendVerifyMail(string userEmail, string varifyCode) { string str_app_name = "Zony遊戲"; var str_url = string.Format("/User/VerifyEmail/{0}", varifyCode); var str_link = Request.Url.AbsoluteUri.Replace(Request.Url.PathAndQuery, str_url); string str_subject = str_app_name + " - 帳號成功建立通知!!"; string str_body = "<br/><br/>"; str_body += "很高興告訴您,您的 " + str_app_name + " 帳戶已經成功建立. <br/>"; str_body += "請按下下方連結完成驗證您的帳號程序!!<br/><br/>"; str_body += "<a href='" + str_link + "'>" + str_link + "</a> "; str_body += "<br/><br/>"; str_body += "本信件由電腦系統自動寄出,請勿回信!!<br/><br/>"; str_body += string.Format("{0} 系統開發團隊敬上", str_app_name); GmailService gmail = new GmailService(); gmail.ReceiveEmail = userEmail; gmail.Subject = str_subject; gmail.Body = str_body; gmail.Send(); return gmail.MessageText; }
public ActionResult Contact(string comment) { var userPrincipal = HttpContext.User as UserPrincipal; var userIdentity = userPrincipal.Identity as UserIdentity; var userData = UserData.FromString(userIdentity.Ticket.UserData); comment = comment.Trim(); if (!comment.EndsWith(".")) { comment = comment + "."; } string adminEmail = RoleEnvironment.GetConfigurationSettingValue("AdminEmail"); string adminName = RoleEnvironment.GetConfigurationSettingValue("AdminFirstName") + ' ' + RoleEnvironment.GetConfigurationSettingValue("AdminLastName"); GmailService.Send(adminEmail, adminName, userData.FirstName + " " + userData.LastName + "<" + userData.Email + ">" + " te envio un comentario", comment); return(new EmptyResult()); }
public ActionResult CreateUser(UserData userData) { if (ModelState.IsValid) { var createStatus = this.MembershipService.CreateUser(userData); if (createStatus == MembershipCreateStatus.Success) { string body = string.Format("{0} buen dia!!, <br/> Tu cuenta para accesar al sitio de Martha & Ivan Wedding " + "<a ref='http://marthaeivan.cloudapp.net'>http://marthaeivan.cloudapp.net</a> ha sido creada" + "<br/><br/>usuario: {1}<br/>password: {2}<br/><br/>" + "Tambien puedes entrar usando tu cuenta de facebook siempre y cuando el correo coincida." , userData.FirstName, userData.Email, userData.Password); GmailService.Send(userData.Email, userData.Email, "Se ha creado tu cuenta :)", body); return(RedirectToAction("CreateUser")); } else { ModelState.AddModelError("", AccountValidation.ErrorCodeToString(createStatus)); } } return(View(userData)); }