public bool SendMail(string recipient) { var result = GetResult(); string body = new JavaScriptSerializer().Serialize(result.Data); Mailing mail = new Mailing("username", "password"); var res = mail.SendMail(recipient, body); return(res); }
public JsonResult KatilmaIstegiGonder(int EtkID) { string result = "false"; Repository <Katilan> repoK = new Repository <Katilan>(new NeYapsakContext()); Repository <Ilan> repoI = new Repository <Ilan>(new NeYapsakContext()); Repository <ApplicationUser> repoA = new Repository <ApplicationUser>(new NeYapsakContext()); ApplicationUser User = repoA.GetAll().Where(u => u.Id == HttpContext.User.Identity.GetUserId()).FirstOrDefault(); Katilan kat = new Katilan(); foreach (Katilan katilan in repoK.GetAll(k => k.IlanId == EtkID).ToList()) { if (katilan.KullaniciId == HttpContext.User.Identity.GetUserId()) { if (katilan.Silindi == true) { katilan.Silindi = false; katilan.Tarih = DateTime.Now; if (repoK.Update(katilan)) { var callbackUrl = Url.Action("EventConfirmPage", "Home", new { Id = katilan.IlanId, code = "" }, protocol: Request.Url.Scheme); IdentityMessage msg = new IdentityMessage(); msg.Subject = "Etkinliğine Katılmak İsteyenler Var."; msg.Destination = katilan.Ilan.User.Email; msg.Body = "Merhaba " + katilan.Ilan.User.Name + ", " + katilan.User.Name + " " + katilan.User.Surname + " " + katilan.Ilan.BaslangicTarihi + " tarihinde yapacağın " + katilan.Ilan.Baslik + " etkinliğine katılmak istiyor. Onaylamak veya Reddetmek için <a href=\"" + callbackUrl + "\">bu link</a>e tıkla."; mail.SendMail(msg); result = "true"; return(Json(result, JsonRequestBehavior.AllowGet)); } } else { ModelState.AddModelError("", "Daha önce katılma isteği gönderdin!"); result = "Daha önce katılma isteği gönderdin!"; return(Json(result, JsonRequestBehavior.AllowGet)); } } } Ilan i = repoI.GetAll().Where(k => k.Id == EtkID).FirstOrDefault(); kat.IlanId = EtkID; kat.KullaniciId = HttpContext.User.Identity.GetUserId(); kat.Tarih = DateTime.Now; kat.Silindi = false; kat.Onay = false; if (repoK.Add(kat)) { var callbackUrl = Url.Action("EventConfirmPage", "Home", new { Id = kat.IlanId, code = "" }, protocol: Request.Url.Scheme); IdentityMessage msg = new IdentityMessage(); msg.Subject = "Etkinliğine Katılmak İsteyenler Var!"; msg.Destination = i.User.Email; msg.Body = "Merhaba " + i.User.Name + ", " + User.Name + " " + User.Surname + " " + i.BaslangicTarihi + " tarihinde yapacağın " + i.Baslik + " etkinliğine katılmak istiyor. Onaylamak veya Reddetmek için <a href=\"" + callbackUrl + "\">yanıtla</a> linkine tıkla."; mail.SendMail(msg); result = "true"; return(Json(result, JsonRequestBehavior.AllowGet)); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public void SendMail() { Mailing m = new Mailing(); //Console.WriteLine("Sending"); //Console.WriteLine("Body = " + Body); //Console.WriteLine("Send?"); //Console.ReadLine(); m.SendMail(To, CC, BCC, From, Subject, Body, ServerIP, Port); //Console.WriteLine("Sent!"); //Console.ReadLine(); }
private void btnSend_Click(object sender, EventArgs e) { Mail.Net.Mailing m = new Mailing(txtUsr.Text, txtPwd.Text, txtSmtpHost.Text, Convert.ToInt32(txtSmtpPort.Text), txtFromAddress.Text, chkSsl.Checked); m.SendMail(txtRecipients.Text, txtBCC.Text, txtSubject.Text, txtBody.Text, () => { MessageBox.Show("Send complete!"); }, (ex) => { MessageBox.Show(ex.ToString()); }); }
async Task MesajMailiGonder(ApplicationUser Gonderici, ApplicationUser Alici, string Mesaj) { IdentityMessage msg = new IdentityMessage(); msg.Subject = Gonderici.Name + " sana bir mesaj gönderdi"; msg.Destination = Alici.Email; var callbackUrl = Url.Action("Index", "Message", null, protocol: Request.Url.Scheme); msg.Body = Gonderici.Name + " " + Gonderici.Surname + " sana:<hr/> " + Mesaj + "<hr/> şeklinde bir mesaj gönderdi. Cevaplamak için seni <a href=\"" + callbackUrl + "\">siteye</a> alalım."; Mailing Mail = new Mailing(); Task.Run(() => Mail.SendMail(msg)); }
public ActionResult IlanBildir(string IlanId, string GondericiId, string Mesaj) { var usermanager = IdentityTools.NewUserManager(); var Gonderici = usermanager.FindById(GondericiId); int Ilanid = Convert.ToInt32(IlanId); Ilan Ilan = ent.Ilanlar.Where(i => i.Id == Ilanid).FirstOrDefault(); IdentityMessage msg = new IdentityMessage(); msg.Subject = Ilan.Baslik + " ilanı hakkında bildirim"; msg.Destination = "*****@*****.**"; var callbackUrl = Url.Action("OtherEventDetail", "Home", new { Id = IlanId }, protocol: Request.Url.Scheme); msg.Body = "İlanlarda yer alan <a href=\"" + callbackUrl + "\">" + Ilan.Baslik + "</a> için <strong><u>" + Mesaj + "</u></strong> şeklinde bir bildirim geldi."; Mailing Mail = new Mailing(); Mail.SendMail(msg); return(RedirectToAction("Main", "Home")); }
protected void btn_smt_Click(object sender, EventArgs e) { string mail = txt_email.Text; string pswrd = "select * from Emp_info where email_id='" + mail + "'"; DataSet ds = new DataSet(); ds = DAL.SqlHelper.ExecuteDataset(clsConnection.Connection, CommandType.Text, pswrd); if (ds.Tables[0].Rows.Count == 1) { string shw = "your User id:" + ds.Tables[0].Rows[0]["emp_Id"].ToString() + ",password:"******"Password"].ToString(); Mailing.SendMail(mail, "your Login Details", shw); lbl_psswrd.Visible = true; lbl_psswrd.Text = "Login Details sent To your E-Mail Id Pls Check Ur Mail......"; } else { lbl_psswrd.Text = ConfigurationManager.AppSettings["Invalid E-Mail id"].ToString(); lbl_psswrd.Visible = true; } }