static async System.Threading.Tasks.Task Test() { Mails mails = new Mails(); mails.ApplicationGUID = "4d53bce03ec34c0a91182d4c228ee6c"; mails.From = "*****@*****.**"; mails.Subject = "TEst "; mails.To = new List <string>() { "*****@*****.**" }; mails.Content = "TEst"; Mailer.APIKey = "A93reRTUJHsCuQSHR+L3GxqOJyDmQpCgps102ciuabc="; Mailer.APPId = "4d53bce03ec34c0a911182d4c228ee6c"; Mailer.mails = mails; Mailer.Endpoint = "http://10.57.31.52:9002/"; var emailResponse = await Mailer.RunAsync(); if (emailResponse.Contains("ERROR")) { Newtonsoft.Json.Linq.JObject json = Newtonsoft.Json.Linq.JObject.Parse(emailResponse); throw new Exception(json["Message"].ToString()); } }
// Get Email with Users Admin public void Recover() { Mails email = mailB.Get(); if (email != null) { List <Users> users = userB.GetAll(); String subJect = "Recuperacion de contraseña del sistema"; String body = "Las contraseñas de usuarios administradores son las siguientes: "; foreach (var item in users) { if (item.Type == true) { Users user = userB.GetById(Convert.ToInt32(item.IDUser)); body = body + "Nickname: " + user.Nickname + ", Clave: " + user.Password + ". "; } } int state = mailB.SendEmail(email.Email, subJect, body); if (state == 500) { TempData["message"] = "ErrorEmail"; } else { TempData["message"] = "SendEmail"; } } }
//Check Users private void Check() { List <Users> users = userB.GetAll(); Mails email = mailB.Get(); if (users.Count == 0) { TempData["type"] = false; } foreach (var item in users) { if (item.Type == true) { TempData["type"] = true; break; } } if (email == null) { TempData["email"] = false; } else { TempData["email"] = true; } }
private void AddMail(int type, int sendtype, int ReceiverID, string uid, string realname, string depname, string sendids, string sendnames, string ccids, string ccnames, string bccids, string bccnames, string attachments) { if (this.ct == 0) { Mails_DetailInfo mails_DetailInfo = new Mails_DetailInfo(); mails_DetailInfo.Attachments = attachments; mails_DetailInfo.Bodys = this.Bodys.Value; mails_DetailInfo.SendIDs = sendids; mails_DetailInfo.SendRealNames = sendnames; mails_DetailInfo.CcIDs = ccids; mails_DetailInfo.CcRealNames = ccnames; mails_DetailInfo.BccIDs = bccids; mails_DetailInfo.BccRealNames = bccnames; this.ct++; Mails_Detail.Init().Add(mails_DetailInfo); this.tobj = mails_DetailInfo; } if (this.tobj.GetType().ToString().Contains("fo")) { Mails_DetailInfo mails_DetailInfo = this.tobj as Mails_DetailInfo; MailsInfo mailsInfo = new MailsInfo(); mailsInfo.ReceiverID = ReceiverID; mailsInfo.SenderID = Convert.ToInt32(uid); mailsInfo.SenderRealName = realname; mailsInfo.SenderDepName = depname; mailsInfo.SendType = sendtype; mailsInfo.Subject = this.Subject.Value; mailsInfo.FolderType = type; mailsInfo.SendTime = DateTime.Now; mailsInfo.did = mails_DetailInfo.id; mailsInfo.SenderGUID = ""; Mails.Init().Add(mailsInfo); } }
public ActionResult Publication(long Id, bool Enabled) { var promotion = DB2.Promotions.SingleOrDefault(x => x.Id == Id); if (promotion == null) { ErrorMessage("Акция не найдена"); return(RedirectToAction("Index")); } ; if (!promotion.CheckSecurity(CurrentUser)) { ErrorMessage("У вас нет прав для изменения данной акции"); return(RedirectToAction("Index")); } promotion.Enabled = Enabled; DB2.PromotionHistory.Add(new PromotionSnapshot(CurrentUser, promotion, DB, DB2) { SnapshotName = "Изменения статуса акции" }); DB2.SaveChanges(); Mails.PromotionNotification(MailType.EditPromotion, promotion); var message = promotion.GetStatus().DisplayName(); SuccessMessage($"Новый статус: {message}"); return(RedirectToAction("Index", new { Id = Id.ToString() })); }
public void ListofRecipients(Mails model) { using (var context = new MailProEntities()) { int Fac = (int)Session["FacultyID"]; model.FacultyID = Fac; List <int> fetch = (List <int>)Session["MailTransfer"]; StudentTable st = new StudentTable(); int i = 0; int count = 0; foreach (var item in fetch) { st = context.StudentTable.SingleOrDefault(x => x.StudentNo == item); ViewBag.Mailer += st.StudentEmail + ",<br/>"; i = i + 1; if (i <= 2) { ViewBag.MailPreview += st.StudentEmail + ','; } else { count++; } } ViewBag.MailPreview += "and " + count + " others"; model.Sent = ViewBag.Mailer; model.MailPreview = ViewBag.MailPreview; } }
public async Task <ViewResult> Mail(Mails model) { try { using (var context = new MailProEntities()) { Thread listing = new Thread(() => ListofRecipients(model)); listing.Start(); await EmailSent(model); if (ViewBag.Message != null) { } model.GmailPassword = "******"; listing.Join(); context.Mails.Add(model); context.SaveChanges(); } return(View()); } catch (Exception ex) { ModelState.AddModelError("", ""); //ViewBag.Msg = "It seems like you haven't selected your recipients"; return(View()); } }
protected void Replay_Btn(object sender, EventArgs e) { string text = base.Request.Form["replay"]; if (!string.IsNullOrEmpty(text.Trim()) && text.Trim() != "在这里输入快捷回复") { MailsInfo mailsInfo = new MailsInfo(); Mails_DetailInfo mails_DetailInfo = new Mails_DetailInfo(); mailsInfo.Subject = "快捷回复:" + this.ViewState["retitle"]; mailsInfo.ReceiverID = Convert.ToInt32(this.ViewState["sid"]); mails_DetailInfo.Bodys = text; mailsInfo.SenderID = Convert.ToInt32(this.Uid); mailsInfo.SenderRealName = this.RealName; mailsInfo.SenderDepName = this.DepName; mailsInfo.SendType = 5; mailsInfo.SendTime = DateTime.Now; mails_DetailInfo.SendIDs = string.Concat(mailsInfo.ReceiverID); mails_DetailInfo.SendRealNames = string.Concat(new object[] { this.ViewState["snames"], " (", this.ViewState["sdep"], ")" }); Mails_Detail.Init().Add(mails_DetailInfo); mailsInfo.did = mails_DetailInfo.id; Mails.Init().Add(mailsInfo); MessageBox.ShowAndRedirect(this, "已经成功回复!", "MailList.aspx?fid=0"); } else { MessageBox.ShowAndRedirect(this, "快捷回复没有任何内容!", "MailList.aspx?fid=0"); } }
private void Run(object obj) { while (Running) { try { using (var clientSocket = _socket.Accept()) { clientSocket.ReceiveTimeout = 200; try { var session = new FakeSmtpSession(clientSocket); session.ReceiveMail(); var mail = session.GetMail(); Mails.Add(mail); } catch (Exception) { // ignored } } } catch (SocketException exception) { if (!Running) { return; } throw; } } }
public override void Write() { _worldPacket.WriteUInt32(Mails.Count); _worldPacket.WriteInt32(TotalNumRecords); Mails.ForEach(p => p.Write(_worldPacket)); }
protected void ImgEnviarMail_Click(object sender, EventArgs e) { try { Enviomail oEnviomail = new Enviomail(); EEnviomail oeEmail = oEnviomail.Envio_mails("589", "Solicitud_Operativo"); Mails oMail = new Mails(); oMail.Server = "mail.lucky.com.pe"; //oeEmail.MailServer; oMail.From = TxtSolicitante.Text; oMail.To = "*****@*****.**"; oMail.Subject = TxtMotivo.Text; oMail.Body = TxtSolicitante.Text + " " + TxtMensaje.Text; oMail.CC = "*****@*****.**"; oMail.BodyFormat = "HTML"; oMail.send(); oMail = null; // oeEmail = null; oEnviomail = null; TxtSolicitante.Text = ""; TxtMotivo.Text = ""; TxtMensaje.Text = ""; } catch (Exception ex) { //Alertas.CssClass = "MensajesSupervisor"; //LblAlert.Text = "Envio Solicitudes"; //LblFaltantes.Text = "Sr. Usuario, se presentó un error inesperado al momento de enviar el correo. Por favor intentelo nuevamente o consulte al Administrador de la aplicación"; //PopupMensajes(); return; } }
protected void Replay_Btn(object sender, EventArgs e) { string text = base.Request.Form["replay"]; if (!string.IsNullOrEmpty(text.Trim()) && text.Trim() != "在这里输入快捷回复") { MailsInfo mailsInfo = new MailsInfo(); Mails_DetailInfo mails_DetailInfo = new Mails_DetailInfo(); mailsInfo.Subject = "快捷回复:" + this.ViewState["retitle"]; mailsInfo.ReceiverID = Convert.ToInt32(this.ViewState["sid"]); mails_DetailInfo.Bodys = text; mailsInfo.SenderID = Convert.ToInt32(this.Uid); mailsInfo.SenderRealName = this.RealName; mailsInfo.SenderDepName = this.DepName; mailsInfo.SendType = 5; mailsInfo.SendTime = DateTime.Now; mails_DetailInfo.SendIDs = string.Concat(mailsInfo.ReceiverID); mails_DetailInfo.SendRealNames = string.Concat(new object[] { this.ViewState["snames"], " (", this.ViewState["sdep"], ")" }); Mails_Detail.Init().Add(mails_DetailInfo); mailsInfo.did = mails_DetailInfo.id; Mails.Init().Add(mailsInfo); string str = HttpContext.Current.Server.HtmlEncode("您好!邮件已成功回复!"); base.Response.Redirect("~/InfoTip/Operate_Success.aspx?returnpage=" + base.Request.Url.AbsoluteUri + "&tip=" + str); } else { base.Response.Write("<script>alert('您还没输入任何内容');window.location='" + base.Request.Url.AbsoluteUri + "'</script>"); } }
public void Init(List <pd_MailInfo> mail_list) { IsInit = true; if (Mails.Count > 0) { List <Mail> noexist = new List <Mail>(); foreach (var mail in Mails) { if (mail_list.Exists(m => m.mail_idx == mail.MailIdx) == false) { noexist.Add(mail); } } if (noexist.Count > 0) { noexist.ForEach(i => Mails.Remove(i)); } } foreach (var info in mail_list) { int index = Mails.FindIndex(mail => mail.MailIdx == info.mail_idx); if (index >= 0) { Mails[index].Data = info; } else { Mails.Add(new Mail(info)); } } OrderMailData(); }
public async Task <ActionResult <Mails> > PostMails(Mails item) { context.Mails.Add(item); await context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetMails), new { id = item.Id }, item)); }
public async Task <IActionResult> PutMails(int id, Mails mails) { if (id != mails.Id) { return(BadRequest()); } _context.Entry(mails).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MailsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
private void AddEntity(object param) { int paramValue = GetParam(param); switch (paramValue) { case 0: Contacts.Add(new Contact { ModelStateChanged = true }); break; case 1: Emails.Add(new EmailAddress { ModelStateChanged = true }); break; case 2: Phones.Add(new PhoneNumber { ModelStateChanged = true }); break; case 3: Mails.Add(new MailingAddress { ModelStateChanged = true }); break; default: break; } }
public ActionResult PasswordRecovery(FormCollection data) { try { var email = data.Get("email"); // get link to reset password var result = client.GetPasswordRequestLink2(email); if (result.ReturnCode == 0) { ModelState.AddModelError(string.Empty, "Cet utilsateur n'existe pas"); return(View()); } else { var Message = Files.ReadContent("PasswordReset.html"); Message = Message.Replace("{email}", result.Email); var callback = Url.Action("ResetPassword", "admin", new { uid = result.UniqueId.Value }, protocol: Request.Url.Scheme); Message = Message.Replace("{url}", callback); Mails.Send("Réinitialiser le mot de passe", result.Email, Message); return(View("~/Views/admin/PasswordResetSuccess.cshtml")); } } catch (Exception ex) { ModelState.AddModelError(string.Empty, ex.Message); return(View()); } }
public ActionResult Mailto(string to, string toName, string from, string fromName, string subject, string message) { if (string.IsNullOrEmpty(to)) { throw new ArgumentNullException("to"); } if (string.IsNullOrEmpty(from)) { throw new ArgumentNullException("from"); } if (string.IsNullOrEmpty(toName)) { var toUser = context.Users.Find(u => u.Email.Equals(to, StringComparison.OrdinalIgnoreCase)); if (toUser != null) { toName = (new UserDecorator(toUser, context)).DisplayName; } } Mails.Enqueue(to, subject, "sys_contact", new { to = to, toName = toName, from = from, fromName = fromName, message = message, appUrl = App.Get().Context.AppUrl.ToString() }); return(new HttpStatusCodeResult(200)); }
public ActionResult DeleteConfirmed(int id) { Mails mails = db.Mails.Find(id); db.Mails.Remove(mails); db.SaveChanges(); return(RedirectToAction("Index")); }
// Use this for initialization void Start() { sInstanse = this; CreateChatBox(); MsgManager.Instance.AddListener("SC_GetMailsList", new HandleMsg(this.SC_GetMailsList)); MsgManager.Instance.AddListener("SC_GetMailInfo", new HandleMsg(this.SC_GetMailInfo)); MsgManager.Instance.AddListener("SC_GetMailRewards", new HandleMsg(this.SC_GetMailRewards)); }
public void SendEMail(EMail mail) { Mails ml = new Mails(mail.To, mail.Subject, mail.Content, null); ml.Send(); }
public static void SendAcknowledgement(string mailRowId, string ackMessage, string mailToUser, string mailFromUser) { string strMailSystem = ConfigurationSettings.AppSettings["MAILSYSTEM"]; string strMailTo = mailToUser; Mails.insertMails(strMailTo, "", "Acknowledgement for message ID: " + ackMessage, "", ackMessage, mailFromUser, strMailSystem, "", "N"); DL_Mails.UpdateAcknowledgmentFlag(mailRowId); }
public ViewModel() { if (MailList.Count == 0) { //Mails = new List<Mail>(); Mails.Add(new Mail("*****@*****.**", "ALo alo", "123")); Mails.Add(new Mail("*****@*****.**", "ALo123 alo", "123123")); } }
public ActionResult RejectRegistration(int id) { var user = DB.Account.Single(x => x.Id == id); user.EnabledEnum = UserStatus.Blocked; DB.SaveChanges(); Mails.RegistrationReject(user, Request.Form["reject-reason"]); SuccessMessage("Сохранено"); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Mail_Id,MailSubject,MailBody,MailTo,MailCC,MailBCC,IsBodyHtml,IsSend,SendDate,ErrorMessage,CreatedDate,CreatedUser")] Mails mails) { if (ModelState.IsValid) { db.Entry(mails).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(mails)); }
protected void Button1_Click(object sender, EventArgs e) { try { int mid = 1, msgid = 1; //System.Windows.Forms.MessageBox.Show("Before alert " + Request.Params.Get("alert")); if (Request.Params.Get("alert") != null) { //System.Windows.Forms.MessageBox.Show("In alert "); Mails m; Messages mg; Clock c; bool MailEnabled = (Request.Params.Get("mail") != null); bool MessageEnabled = Request.Params.Get("message") != null; if (MailEnabled || MessageEnabled) { c = InitializeClock(); c.Save(); if (MailEnabled) { Label1.Text += " Mail "; m = new Mails(-1, TextBox1.Text, TextBox2.Text, TextBox3.Text, c.getId()); m.save(); mid = m.getId(); } if (MessageEnabled) { Label1.Text += " Message"; mg = new Messages(-1, TextBox4.Text, TextBox6.Text, c.getId()); mg.save(); msgid = mg.getId(); } } } // System.Windows.Forms.MessageBox.Show("Before saving"); Label1.Text += " Remainder"; Reminder r = new Reminder(u.getUserName(), Calendar1.SelectedDate.ToString("dd/MMM/yyyy"), DropDownList10.SelectedItem.Text, TextBox7.Text, mid, msgid); // System.Windows.Forms.MessageBox.Show("After saving"); Label1.Text = r.getQuery(); if (r.save()) { /*Response.Write("<script language='javascript'>"+ "alert('Reminder added successfully..');"+ "window.open('./RemindersList.aspx');"+ "alert('new Page');"+ "</script>");*/ Response.Redirect("RemindersList.aspx"); } else Response.Write("<script language='javascript'>alert('An error occured in saving your reminder , try again after few seconds');</script>"); } catch (Exception ee) { Response.Write(ee.Message); } }
public ActionResult Edit(Mails emails) { int status = emailsB.Update(emails); if (status == 200) { TempData["message"] = "Update"; return(Json(new { success = true })); } return(View(emails)); }
/// <summary> /// Безвозвратно удалить /// </summary> /// <param name="id">идентификатор новости</param> /// <returns></returns> public ActionResult Delete(long id) { var news = DB2.Newses.Find(id); DB2.Newses.Remove(news); DB2.SaveChanges(); Mails.NewsChanged(news, "Новость удалена", root); SuccessMessage("Новость удалена"); return(RedirectToAction("Archive")); }
private void SendMail2(string subject, string content) { try { Mails ml = new Mails("*****@*****.**", subject, content, null); ml.Send(); } catch (Exception ex) { } }
public async Task <IActionResult> PutCarreras(int id, Mails item) { if (id != item.Id) { return(BadRequest()); } context.Entry(item).State = EntityState.Modified; await context.SaveChangesAsync(); return(NoContent()); }
//Update Email public int Update(Mails emails) { try { emails.Password = Encrypt(emails.Password); db.Update_Email(emails); return(200); } catch (Exception) { return(500); } }
public Mails[] getByClockId(int ClockId) { string temp = "SELECT count(*) FROM Mails WHERE clock_id=" + ClockId; OleDbDataReader t = DataBase.getData(temp); int Count = 0; if (t.Read()) Count = int.Parse(t[0].ToString()); Mails[] m = new Mails[Count]; string query = "SELECT * FROM Mails WHERE clock_id=" + ClockId; OleDbDataReader odr = DataBase.getData(query); for (int i = 0; odr.Read(); i++) m[i] = new Mails(int.Parse(odr[0].ToString()), odr[1].ToString(), odr[2].ToString(), odr[3].ToString(),int.Parse(odr[4].ToString())); return m; }
protected void FormView1_ItemUpdated(object sender, FormViewUpdatedEventArgs e) { int MailId = (int)Session["MLID"]; if(MailId == DEFAULT_MLID) // 114 --> Default MailId { // Creating New Mail Mails Default = Mails.getById(MailId); Mails NewMail = new Mails(-1,Default.getToAddress(),Default.getSubject(),Default.getBody(),Default.getClockId()); //Clearing Default Mail Default.setToAddress(""); Default.setSubject(""); Default.setBody(""); Default.update(); NewMail.save(); Session.Add("MLID", NewMail.getId()); //System.Windows.Forms.MessageBox.Show(NewMail.getId() + ""); //Updating MailId of Reminder Reminder r = Reminder.getById(((int)Session["RID"])); r.setMailsId(NewMail.getId()); r.update(); //System.Windows.Forms.MessageBox.Show("Reminder Updated"); TextBox t = (TextBox)Session["MLTB"]; t.Text = NewMail.getId() + ""; } }