public ActionResult UserForgotpassword(string email) { if (email == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } User user = db.Users.FirstOrDefault(x => x.userEmail == email); if (user == null) { ViewBag.Sonuc = "Böyle bir eposta adresi bulunamadı!"; } else { Random rnd = new Random(); var number = rnd.Next(); var newPassword = Crypto.Hash(number.ToString(), "MD5"); user.userPassword = newPassword; WebMail.SmtpServer = "smtp.gmail.com"; WebMail.EnableSsl = true; WebMail.UserName = "******"; WebMail.Password = "******"; WebMail.SmtpPort = 587; try { WebMail.Send( to: email, subject: "Şifre Yenileme", body: "Şifreniz: " + number.ToString(), from: "*****@*****.**"); ViewBag.Sonuc = "Yeni şifre Eposta adresinize gönderilmiştir."; db.SaveChanges(); } catch (Exception e) { ViewBag.Sonuc = e.Message; } } return(View()); }
public ActionResult RejectClaim(string claimId, string reportId) { if ((Session["officerId"] != null) && Session["role"].ToString() == "Claim officer") { int claimID = int.Parse(claimId); var rejectclaim = db.Claims.Where(c => c.claimId == claimID).FirstOrDefault(); rejectclaim.status = "rejected"; db.Entry(rejectclaim).State = EntityState.Modified; db.SaveChanges(); int reportID = int.Parse(reportId); var report = db.Reports.Where(r => r.reportId == reportID).FirstOrDefault(); report.status = "rejected"; db.Entry(report).State = EntityState.Modified; db.SaveChanges(); var data = db.Claims.Where(c => c.claimId == claimID).FirstOrDefault(); Mail obj = new Mail(); obj.ToEmail = data.MailID; obj.EmailSubject = "Claim-status---This is an auto Generated Mail"; obj.EMailBody = "Sorry, Your claim is rejected due to discrepancy found in details"; WebMail.SmtpServer = "smtp.gmail.com"; WebMail.SmtpPort = 587; WebMail.SmtpUseDefaultCredentials = true; WebMail.EnableSsl = true; WebMail.UserName = "******"; WebMail.Password = "******"; WebMail.From = "Your mailId here"; WebMail.Send(to: obj.ToEmail, subject: obj.EmailSubject, body: obj.EMailBody, cc: obj.EmailCC, bcc: obj.EmailBCC, isBodyHtml: true); return(RedirectToAction("CompletedReport")); } else { return(RedirectToAction("OfficerLogin", "Officer")); } }
public ActionResult SendEmail(FormCollection post) { string Email = post["Email"]; string subject = "此為系統自動發送信件,請勿直接回覆。"; Random VerifyNumber = new Random(); UserDataBaseEntitiesEntities db = new UserDataBaseEntitiesEntities(); var member = db.UserActivation .Where(m => m.email == Email).FirstOrDefault(); if (member != null) { member.Random = Convert.ToString(VerifyNumber.Next(99999)); string body = "親愛的顧客您好,以下為您的Email驗證碼:【 " + member.Random + " 】,請在10分鐘內前往填寫驗證碼。"; WebMail.Send(Email, subject, body, null, null, null, true, null, null, null, null, null); ViewBag.msg = "Email成功傳送,請至信箱擷取驗證碼..."; return(View("ForgetPassword")); } else { ViewBag.msg = "Email傳送失敗,請聯絡管理員進行了解(開玩笑的不要找我)"; return(View("ForgetPassword")); } }
public ActionResult sendemail(email model) { RequestModelContext db = new RequestModelContext(); //var customerName = Request["customerName"]; //var customerEmail = Request["customerEmail"]; //var customerRequest = Request["customerRequest"]; var errorMessage = ""; var debuggingFlag = false; try { // Initialize WebMail helper WebMail.SmtpServer = "smtp.gmail.com"; WebMail.SmtpPort = 25; WebMail.EnableSsl = true; WebMail.UserName = "******"; WebMail.Password = "******"; WebMail.From = model.to; // Send email WebMail.Send(to: model.to, subject: "Администратор " + model.to + " готов Вам помочь", body: model.to ); } catch (Exception ex) { errorMessage = ex.Message; } return(View()); }
public ActionResult SendEmail() { try { //发送电子邮件的SMTP的服务器名称 WebMail.SmtpServer = "smtp.qq.com"; //发送端口 WebMail.SmtpPort = 25; //启用SSL(GMAIL需要),其他的都不需要 WebMail.EnableSsl = true; //-----------配置 //账户名 WebMail.UserName = "******"; //邮箱名 WebMail.From = "*****@*****.**"; //密码 WebMail.Password = "******"; //设置默认配置 WebMail.SmtpUseDefaultCredentials = true; WebMail.Send( to: "*****@*****.**", //指定地址 subject: "测试标题1", //标题 body: "天天开心" //内容 ); return(Content("SUCCESS", "application/json")); } catch (Exception) { return(Content("Fail", "application/json")); } }
public ActionResult Register([Bind(Include = "Id,Name,Email,ContactNo,Date,Address,DepartmentId")] Student student) { if (ModelState.IsValid) { student.StudentRegNo = GetStudentRegNo(student); db.Students.Add(student); db.SaveChanges(); WebMail.SmtpServer = "smtp-mail.outlook.com"; WebMail.SmtpPort = 587; WebMail.SmtpUseDefaultCredentials = true; WebMail.EnableSsl = true; WebMail.UserName = "******"; WebMail.Password = "******"; WebMail.From = "*****@*****.**"; WebMail.Send(to: student.Email, subject: "Studentship Confirmation", body: "Hello " + " " + student.Name + " " + "<br />" + "Your Matriculation Number is :" + " " + student.StudentRegNo + "<br /> " + "Your Registration was Successful " + "<br />", isBodyHtml: true); ViewBag.Message = "Student Registered Successfully"; } ViewBag.DepartmentId = new SelectList(db.Departments, "Id", "DeptCode", student.DepartmentId); return(View(student)); }
public ActionResult ContactUsView(ContactUs obj) { try { if (ModelState.IsValid) { WebMail.Send( "*****@*****.**", obj.Name + "'s Message", "<b>Message: <br/></b>" + obj.Message + "<br/><br/>" + obj.Name + " Mail address is: " + obj.Email, null, null, null, true, null, null, null, null, null, obj.Email ); return(RedirectToAction("Index")); } } catch (Exception) { ViewBag.Error = "Problems sending Email!"; } return(View()); }
public ActionResult iletisim(string mail, string konu, string ileti) { try { WebMail.SmtpServer = "smtp.live.com"; WebMail.EnableSsl = true; WebMail.UserName = "******"; WebMail.Password = "******"; WebMail.SmtpPort = 587; WebMail.Send( "*****@*****.**", konu, ileti, mail ); return(RedirectToAction("mesaj", "Home", new { mesaj = "iletişim Formunuz başarıyla gönderildi" })); } catch (Exception ex) { ViewData.ModelState.AddModelError("_HATA", ex.Message); } return(View()); }
public ActionResult ChangeStatus([Bind(Include = "Id,ApplyAt,ResumeId,JobId,Why_Should_we_hire_you_,Whats_your_dream_job_,JobStatus")] JobApply jobApply) { if (ModelState.IsValid) { db.Entry(jobApply).State = EntityState.Modified; db.SaveChanges(); WebMail.SmtpServer = "smtp.gmail.com"; WebMail.SmtpPort = 587; WebMail.SmtpUseDefaultCredentials = true; WebMail.EnableSsl = true; WebMail.UserName = "******"; WebMail.Password = "******"; WebMail.From = "*****@*****.**"; WebMail.Send(to: jobApply.Resume.AspNetUser.UserName, subject: "status apdated", body: "your job =" + jobApply.Job.JobTitle + "status changed to" + jobApply.JobStatus + "so please chaeck your account", isBodyHtml: true); ViewBag.Status = "Email Sent Successfully."; return(RedirectToAction("Job")); } return(View(jobApply)); }
public ActionResult About(Msgbox obj) { try { //Configuring webMail class to send emails //gmail smtp server WebMail.SmtpServer = "smtp.gmail.com"; //gmail port to send emails WebMail.SmtpPort = 587; WebMail.SmtpUseDefaultCredentials = true; //sending emails with secure protocol WebMail.EnableSsl = true; //EmailId used to send emails from application WebMail.UserName = "******"; WebMail.Password = "******"; //Sender email address. WebMail.From = "*****@*****.**"; //Send email WebMail.Send(to: "*****@*****.**", subject: obj.EmailSubject, body: obj.EMailBody, cc: obj.EmailCC, bcc: obj.EmailBCC, isBodyHtml: true); ViewBag.Status = "Email Sent Successfully."; } catch (Exception) { ViewBag.Status = "Problem while sending email, Please check details."; } return(View()); }
public void SendEmail(Booking model) { var boddy = new StringBuilder(); boddy.Append("Dear: " + model.UserName + "," + "<br/>These are your booking details: " + "<br/>Event: " + model.BookedEvent.Name + "<br/>Date: " + model.Date.ToShortDateString() + "<br/>Time: " + model.BookTime.ToShortTimeString() + "<br/>Venue: " + model.BookedEvent.Venue + "<br" + "<br/>We miss you already, visit us again :) "); string bodyFor = boddy.ToString(); string subjectFor = "Booking"; string toFor = model.Email; var mail = new MailAddress("*****@*****.**", "Matric Excemption Centre"); WebMail.SmtpServer = "pod51014.outlook.com"; WebMail.SmtpPort = 587; WebMail.UserName = "******"; WebMail.Password = "******"; WebMail.From = mail.ToString(); WebMail.EnableSsl = true; try { WebMail.Send(toFor, subjectFor, bodyFor); } catch { // ignored } }
public ActionResult Buy(Purchase purchase) { IEnumerable <Book> books = db.Books; ViewBag.Books = books; var list = books.ToList(); purchase.Date = DateTime.Now; purchase.FileName = "download.png"; db.Purchases.Add(purchase); db.SaveChanges(); void SendMail() { WebMail.SmtpServer = "smtp.gmail.com"; WebMail.SmtpPort = 587; WebMail.EnableSsl = true; WebMail.UserName = "******"; WebMail.Password = "******"; WebMail.Send(purchase.Address, "благодорим за покупку," + " " + purchase.Person, "Вы купили книгу:" + list[purchase.BookId - 1].Name + "<br>" + "Автора:" + list[purchase.BookId - 1].Author + "<br>" + " Время и дата покупки: " + purchase.Date, "*****@*****.**"); } ViewBag.BookName = "<div class= \'order\'>" + "<h2>" + "Спасибо, " + purchase.Person + ", за покупку! " + "</h2>" + "ты купил книгу: " + "<br>" + " Автор: " + list[purchase.BookId - 1].Author + "<br>" + " Название книги:" + list[purchase.BookId - 1].Name + "<br>" + "Она стоила: " + list[purchase.BookId - 1].Price + "евро" + "<br>" + " Время и дата покупки: " + purchase.Date + "<br>" + " Книга будет доставлена на адресс: " + purchase.Address; SendMail(); return(View()); }
private Boolean EnviarEmail(EmailModel email) { try { //Configuring webMail class to send emails //gmail smtp server WebMail.SmtpServer = "smtp.gmail.com"; //gmail port to send emails WebMail.SmtpPort = 587; WebMail.SmtpUseDefaultCredentials = true; //sending emails with secure protocol WebMail.EnableSsl = true; //EmailId used to send emails from application WebMail.UserName = "******"; WebMail.Password = "******"; //Sender email address. WebMail.From = "*****@*****.**"; //Send email WebMail.Send(to: email.ToEmail, subject: email.EmailSubject, body: email.EMailBody, cc: email.EmailCC, bcc: email.EmailBCC, isBodyHtml: true); ViewBag.Status = "Correo electrónico enviado con Éxito."; } catch (Exception ex) { ViewBag.Status = "Problema al enviar el correo electrónico. Por favor verifique los detalles: " + Environment.NewLine + ex.Message; return(false); } return(true); }
public async Task <Response> EnviarContrasena(RecuperarContrasenaRequest recuperarContrasenaRequest) { try { //Configuring webMail class to send emails //gmail smtp server WebMail.SmtpServer = CorreoUtil.SmtpServer; //gmail port to send emails WebMail.SmtpPort = Convert.ToInt32(CorreoUtil.Port); WebMail.SmtpUseDefaultCredentials = true; //sending emails with secure protocol WebMail.EnableSsl = true; //EmailId used to send emails from application WebMail.UserName = CorreoUtil.UserName; WebMail.Password = CorreoUtil.Password; //Sender email address. WebMail.From = CorreoUtil.UserName; //Send email WebMail.Send(to: recuperarContrasenaRequest.Email, subject: "Contraseña: " + recuperarContrasenaRequest.Codigo, body: "Contraseña: " + recuperarContrasenaRequest.Codigo, isBodyHtml: true); return(new Response { IsSuccess = true }); } catch (Exception ex) { throw; } }
public void AssignHeaderValuesSetsPropertiesForKnownHeaderValues() { // Arrange var message = new MailMessage(); var headers = new[] { "cc:[email protected]", "bcc:[email protected],[email protected]", "from:[email protected]", "priority:high", "reply-to:[email protected],[email protected]", "sender: [email protected]", "to:[email protected]" }; // Act WebMail.AssignHeaderValues(message, headers); // Assert Assert.Equal("*****@*****.**", message.CC.Single().Address); Assert.Equal("*****@*****.**", message.Bcc.First().Address); Assert.Equal("*****@*****.**", message.Bcc.Last().Address); Assert.Equal("*****@*****.**", message.From.Address); Assert.Equal(MailPriority.High, message.Priority); Assert.Equal("*****@*****.**", message.ReplyToList.First().Address); Assert.Equal("*****@*****.**", message.ReplyToList.Last().Address); Assert.Equal("*****@*****.**", message.Sender.Address); Assert.Equal("*****@*****.**", message.To.Single().Address); // Assert we transparently set header values Assert.Equal(headers.Count(), message.Headers.Count); }
public static bool SendNotification(int empid, string sub, string msg) { Employee obj = EmailService.GetUser(empid); //Configuring webMail class to send emails //gmail smtp server WebMail.SmtpServer = "smtp.gmail.com"; //gmail port to send emails WebMail.SmtpPort = 587; WebMail.SmtpUseDefaultCredentials = true; //sending emails with secure protocol WebMail.EnableSsl = true; //EmailId used to send emails from application WebMail.UserName = "******"; WebMail.Password = "******"; //Sender email address. WebMail.From = "*****@*****.**"; //Send email WebMail.Send(to: "*****@*****.**", subject: sub, body: msg, isBodyHtml: true); return(true); }
public ActionResult SifremiUnuttum(string eposta) { var mail = db.Admin.Where(x => x.EPosta == eposta).SingleOrDefault(); if (mail != null) { Random rnd = new Random(); int yeniSifre = rnd.Next(); Admin admin = new Admin(); mail.Sifre = Crypto.Hash(Convert.ToString(yeniSifre), "MD5"); db.SaveChanges(); WebMail.SmtpServer = "smtp.gmail.com"; WebMail.EnableSsl = true; WebMail.UserName = "******"; WebMail.Password = "******"; WebMail.SmtpPort = 587; WebMail.Send(eposta, "Admin Panel Giriş Şifreniz", "Şifreniz:" + yeniSifre); ViewBag.Uyari = "Şifreniz başarı ile gönderilmiştir."; } else { ViewBag.Uyari = "Hata oluştu tekrar deneyiniz."; } return(View()); }
public static void SendEmail(string receiver, string subject, string body) { WebMail.SmtpServer = "smtp.gmail.com"; //gmail port to send emails WebMail.SmtpPort = 587; WebMail.SmtpUseDefaultCredentials = true; //sending emails with secure protocol WebMail.EnableSsl = true; //EmailId used to send emails from application using (var db = new Entities()) { var userName = db.Settings.FirstOrDefault(s => s.Key.Equals(Constant.ApplicationEmail))?.Value; var password = db.Settings.FirstOrDefault(s => s.Key.Equals(Constant.ApplicationEmailPassword))?.Value; if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(password)) { WebMail.UserName = userName; WebMail.Password = password; //Sender email address. WebMail.From = userName; //Send email WebMail.Send(receiver, subject, body); } } }
// GET: About public ActionResult Index(string name, string email, string message) { try { //Configuring webMail class to send emails //gmail smtp server WebMail.SmtpServer = "smtp.gmail.com"; //gmail port to send emails WebMail.SmtpPort = 587; WebMail.SmtpUseDefaultCredentials = true; //sending emails with secure protocol WebMail.EnableSsl = true; //EmailId used to send emails from application WebMail.UserName = "******"; WebMail.Password = "******"; //Sender email address. WebMail.From = "*****@*****.**"; //Send email WebMail.Send(to: email, subject: "góp ý", body: email + " đã gửi " + name + " là người " + " nội dung " + message, cc: null, bcc: null, isBodyHtml: true); ViewBag.Status = "Email Sent Successfully."; } catch (Exception) { ViewBag.Status = "Problem while sending email, Please check details."; } return(View()); }
public static void SendEmail(string RecipientEmail, string Subject, string Content) { //Configuring webMail class to send emails //gmail smtp server WebMail.SmtpServer = "smtp-mail.outlook.com"; //gmail port to send emails WebMail.SmtpPort = 587; WebMail.SmtpUseDefaultCredentials = true; //sending emails with secure protocol WebMail.EnableSsl = true; //Email ID used to send emails from application WebMail.UserName = ""; WebMail.Password = ""; //Sender email address WebMail.From = ""; //Send email WebMail.Send(to: RecipientEmail, subject: Subject, body: Content, isBodyHtml: true); }
public ActionResult Index() { bool sonuc = false; WebMail.SmtpServer = "smtp.gmail.com"; WebMail.SmtpPort = 587; WebMail.UserName = "******"; WebMail.Password = "******"; WebMail.EnableSsl = true; string file = Server.MapPath("~/Content/Files/Deneme_Word.docx"); try { WebMail.Send( to: "*****@*****.**", subject: "Merhaba", body: "Deneme Mail'lidir.Asp.Net MVC'de <strong>WebMail</strong> kullanarak atılmıştır", isBodyHtml: true, filesToAttach: new[] { file } ); ViewBag.Success = !sonuc; } catch (Exception) { ViewBag.Success = sonuc; } return(View()); }
public ActionResult GuiMail(QuenMatKhau qmk) { try { // Định cấu hình lớp webMail để gửi email // máy chủ gmail smtp WebMail.SmtpServer = "smtp.gmail.com"; // cổng gmail để gửi email WebMail.SmtpPort = 587; WebMail.SmtpUseDefaultCredentials = true; // gửi email với giao thức bảo mật WebMail.EnableSsl = true; // EmailId được sử dụng để gửi email từ ứng dụng WebMail.UserName = "******"; WebMail.Password = "******"; // Địa chỉ email người gửi. WebMail.From = "*****@*****.**"; USSER nd = db.USSERs.FirstOrDefault(t => t.EMAIL == qmk.EmailNhan); qmk.ChuDe = "Xác nhận đổi mật khẩu "; qmk.NoiDung = "Xác nhận:'https://localhost:44348/QuenMatKhau/Thaydoimatkhau/" + nd.ID + "?Token=" + nd.Token; //Gửi email WebMail.Send(to: qmk.EmailNhan, subject: qmk.ChuDe, body: qmk.NoiDung, cc: qmk.Cc, bcc: qmk.Bcc, isBodyHtml: true); ViewBag.Status = "Email được gửi thành công."; } catch (Exception) { ViewBag.Status = "Sự cố trong khi gửi email, vui lòng kiểm tra chi tiết."; } return(View()); }
public ActionResult ForgotPassword(ForgotPassword fp) { try { // Máy chủ gmail WebMail.SmtpServer = "smtp.gmail.com"; // Cổng WebMail.SmtpPort = 465; WebMail.SmtpUseDefaultCredentials = true; //Gửi gmail với giao thức bảo mật WebMail.EnableSsl = true; //Tài khoản dùng để đăng nhập vào gmail để gửi WebMail.UserName = "******"; WebMail.Password = "******"; // Nội dung gửi WebMail.From = "*****@*****.**"; User user = db.Users.SingleOrDefault(n => n.user_email == fp.ConfirmationEmail); fp.Theme = "Xác nhận mật khẩu Web"; fp.Content = "Xác Nhận: https://localhost:44327/Users/ChangePassword/" + user.user_id + "&Token=" + user.user_token; //Gửi gmail WebMail.Send(to: fp.ConfirmationEmail, subject: fp.Theme, body: fp.Content, cc: fp.Cc, bcc: fp.Bcc, isBodyHtml: true); ViewBag.Sucess = "Gửi thành công! Vui lòng kiểm tra email/gmail."; } catch (Exception) { ViewBag.Fail = "Gửi gmail thất bại! Vui lòng thử lại."; } return(View()); }
private void sendingRsvpNotificationMail(GuestResponse model) { WebMail.SmtpServer = "localhost"; WebMail.SmtpPort = 25; WebMail.From = "*****@*****.**"; WebMail.Send(@"*****@*****.**", "RSVP notification", model.Name + " is " + (model.WillAttend.Value ? "" : "not ") + "attending"); }
public ActionResult SendEmail(Email obj) { try { if (ModelState.IsValid) { //Configuring webMail class to send emails //gmail smtp server WebMail.SmtpServer = "smtp.gmail.com"; //gmail port to send emails WebMail.SmtpPort = 587; WebMail.SmtpUseDefaultCredentials = true; //sending emails with secure protocol WebMail.EnableSsl = true; //EmailId used to send emails from application WebMail.UserName = "******"; WebMail.Password = "******"; //Sender email address. WebMail.From = obj.FromEmail; //Send email WebMail.Send(to: "*****@*****.**", from: obj.FromEmail, subject: obj.EmailSubject, body: obj.EMailBody, isBodyHtml: true); ViewBag.Status = "Email Sent Successfully."; } } catch (Exception) { ViewBag.Status = "Problem while sending email, Please check details."; } return(View()); }
//https://support.google.com/accounts/answer/6010255?hl=tr adresinden Authentication Required hatasını düzeltebiliriz. // GET: WebMail public ActionResult Index() { bool sonuc = false; //atacağımız server adresi ,gmail ise bu WebMail.SmtpServer = "smtp.gmail.com"; WebMail.SmtpPort = 587; WebMail.UserName = "******"; WebMail.Password = "******"; WebMail.EnableSsl = true; string file = Server.MapPath("~/images/cat.jpg"); try { WebMail.Send( to: "*****@*****.**", subject: "WebMail Test", body: "Bu bir web mail denemesidir.<br><b>Litfen dikkate almayınız..</b>", replyTo: "*****@*****.**", isBodyHtml: true, filesToAttach: new[] { file }); sonuc = true; }catch (Exception e) { ViewBag.Hata = e.Message; } ViewBag.Sonuc = sonuc; return(View()); }
public ActionResult Email(EmailViewModel viewModel) { // Make sure the data coming server-side is valid // You can use validation attributes like [Required] in your View Model if (ModelState.IsValid) { try { WebMail.SmtpServer = "localhost"; WebMail.SmtpPort = 25; WebMail.EnableSsl = false; WebMail.UserName = "******"; WebMail.Password = "******"; WebMail.From = "user@localhost";; WebMail.Send( "test@localhost", viewModel.RequestorName, // RequestorName entered from form viewModel.RequestorDate.ToString() // RequestorDate entered from form ); } catch (Exception ex) { errorMessage = ex.Message; } } return(View(viewModel)); }
public ActionResult SendEmail(Mail obj) { try { //Configuring webMail class to send emails //gmail smtp server WebMail.SmtpServer = "smtp.gmail.com"; //gmail port to send emails WebMail.SmtpPort = 587; WebMail.SmtpUseDefaultCredentials = true; //sending emails with secure protocol WebMail.EnableSsl = true; //EmailId used to send emails from application WebMail.UserName = "******"; WebMail.Password = "******"; User info = db.Users.SingleOrDefault(t => t.Email == obj.ToEmail); //Sender email address. WebMail.From = "*****@*****.**"; obj.EmailSubject = "Reset Password"; obj.EMailBody = "<a href='https://localhost:44328/ForgotPassword/ResetPassword/" + info.IDUser + "?token=" + info.Token + "'>Reset Password</a>"; //Send email WebMail.Send(to: obj.ToEmail, subject: obj.EmailSubject, body: obj.EMailBody, cc: obj.EmailCC, bcc: obj.EmailBCC, isBodyHtml: true); ViewBag.Status = "Email Sent Successfully."; } catch (Exception) { ViewBag.Status = "Problem while sending email, Please check details."; } return(View()); }
public ActionResult AdminForgotPassword(Admin admin) { var results = db.Students.Find(admin.Admin_Username); if (results != null) { try { WebMail.SmtpServer = "smtp.gmail.com"; WebMail.SmtpPort = 587; WebMail.SmtpUseDefaultCredentials = true; WebMail.EnableSsl = true; WebMail.UserName = "******"; WebMail.Password = "******"; WebMail.From = "*****@*****.**"; WebMail.Send(to: admin.Admin_Email, subject: "Good day applicant" + admin.Admin_Username, body: "Your password to login into our system is : " + results.Student_Password, isBodyHtml: true); } catch (Exception) { } return(RedirectToAction("AdminLogin", admin)); } else { //viewbag ayesha } return(View()); }
public void SendEmail() { // This information would need to be replaced with your own // or call your own email sending methods try { WebMail.SmtpServer = "my.smtpserver.com"; WebMail.SmtpPort = 123; WebMail.EnableSsl = false; WebMail.UserName = "******"; WebMail.Password = "******"; WebMail.From = "*****@*****.**"; WebMail.SmtpUseDefaultCredentials = false; WebMail.Send( to: "*****@*****.**", subject: "SecureSubmit Payment", body: "Congratulations, you have just completed a SecureSubmit payment!" ); } catch (Exception e) { Response.Write("<strong>Couldn't Send Email</strong>"); } }