public async Task <IActionResult> ResendEmail([FromBody] Login body) { await Db.Connection.OpenAsync(); body.Email = body.Email.ToLower(); //create user object and fill it with user UserQuerry resend = new UserQuerry(Db); User resendUser = await resend.GetUserByEmail(body.Email); // check if user is verified if (resendUser.Verified != "true") { // if not resend email MailHandler mailHandler = new MailHandler(); mailHandler.Execute(body.Email, resendUser.FirstName, resendUser.Verified); Db.Dispose(); return(new OkObjectResult("email resend")); } else { // if is then give error Db.Dispose(); return(new ConflictObjectResult("User Already verified")); } }
public void SendMailList() { if (firstCheckSinceLogin) { ServerApp <RealmServer> .IOQueue.AddMessage(new Message(() => { Load(); IContextHandler contextHandler = m_chr.ContextHandler; if (contextHandler == null) { return; } contextHandler.AddMessage(() => { if (m_chr == null || !m_chr.IsInWorld) { return; } SendMailList(); }); })); firstCheckSinceLogin = false; } else { MailHandler.SendMailList(m_chr.Client, CollectMail()); } }
private void onLoginButtonClicked(Object state) { try { string userName = UserNameTextBox.Text; string password = PasswordTextBox.Text; if (Utils.checkNameAndPass(userName, password)) { MailHandler handler = new MailHandler(); List <IMail> emails = handler.loadUserEmails(userName, password); foreach (IMail email in emails) { string[] row = { email.Date.ToString(), email.Subject }; if (dataGridView1.InvokeRequired) { invokeIt inv = new invokeIt(DataGridAdd); Invoke(inv, new object[] { row }); } else { dataGridView1.Rows.Add(row); } userMail = UserNameTextBox.Text; userPassword = PasswordTextBox.Text; } } } catch (ImapResponseException) { MessageBox.Show("Not valid email or password"); } }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddCors(options => { options.AddPolicy("AllowAll", p => { p.AllowAnyOrigin() .AllowAnyHeader() .AllowAnyMethod() .AllowCredentials(); }); }); // Initialize all classes instances for the BL and DAL FinanceDb finance = new FinanceDb(); MailDb mails = new MailDb(); var mailHandler = new MailHandler("*****@*****.**", "Michael", "Miki2995*", mails.UserMailRecipients); var rContainer = new RouteContainer(mailHandler, "Finance Route was used and this is the result"); var routes = new Dictionary <string, IRoute>() { { "finance", new FinanceRoute(rContainer, finance.MoneyList) } }; services.AddSingleton <IRequestRouter>(new SimpleRequestRouter(routes)); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); }
private void btnSend_Click(object sender, EventArgs e) { CoverObjectUtility.GetAutoBindingData(this, _mReq); _mReq.SetCreate(); _mReq.Email = txtEmail.Text; try { using (IUnitOfWork uow = new UnitOfWork()) { uow.RequestPaymentBaseRepository.Add(_mReq); uow.Commit(); } InformationMailModel mail = new InformationMailModel(); mail.Subject = _mReq.Title; mail.SendersAddress = "*****@*****.**"; mail.SenderPassword = "******"; mail.Content = _mReq.RequestContent; mail.ReceiverAddress = _mReq.Email; IMailHandler iMailHandler = new MailHandler(); iMailHandler.SendMail(mail); if (AddRequestCode != null) { DebtDetail detail = new DebtDetail(); detail.Payment = 0; detail.PaymentDate = null; detail.RequestPaymentCode = _mReq.RequestCode; AddRequestCode(detail, Utility.CRUD.Insert); } lblNotify.SetText(UI.success, ToolBoxCS.LabelNotify.EnumStatus.Success); } catch { lblNotify.SetText(UI.failed, ToolBoxCS.LabelNotify.EnumStatus.Failed); } }
public void BroadcastNhoodState(IDA da, MailHandler mail, DbNeighborhood nhood, DbElectionCycle cycle) { var all = Sessions.Clone(); foreach (var session in all.OfType <IVoltronSession>()) { if (session.IsAnonymous) { continue; } var myLotID = da.Roommates.GetAvatarsLots(session.AvatarId).FirstOrDefault(); var myLot = (myLotID == null) ? null : da.Lots.Get(myLotID.lot_id); var free = da.Elections.GetFreeVote(session.AvatarId); var nhoodID = (int)(myLot?.neighborhood_id ?? 0); if (free != null) { nhoodID = free.neighborhood_id; //enrolled to a free vote. receive vote mail for that neighborhood } if (myLot != null && nhoodID == nhood.neighborhood_id) { SendStateEmail(da, mail, nhood, cycle, session.AvatarId); } } }
public static MailError SendMail(uint recipientLowId, string subject, string body, MailStationary stationary, ICollection <ItemRecord> items, uint money, uint cod, IPacketReceiver sender) { if (sender != null) { MailHandler.SendResult(sender, 0U, MailResult.MailSent, MailError.OK); } uint num = 0; MailMessage letter = new MailMessage(subject, body) { LastModifiedOn = new DateTime?(), SenderId = sender is IEntity ? ((IEntity)sender).EntityId.Low : 0U, ReceiverId = recipientLowId, MessageStationary = stationary, MessageType = MailType.Normal, CashOnDelivery = cod, IncludedMoney = money, SendTime = DateTime.Now, DeliveryTime = DateTime.Now.AddSeconds((double)num) }; if (items != null && items.Count > 0) { letter.SetItems(items); } MailMgr.SendMail(letter); return(MailError.OK); }
public void SendMailList() { if (this.firstCheckSinceLogin) { ServerApp <WCell.RealmServer.RealmServer> .IOQueue.AddMessage((IMessage) new Message((Action)(() => { this.Load(); IContextHandler contextHandler = this.m_chr.ContextHandler; if (contextHandler == null) { return; } contextHandler.AddMessage((Action)(() => { if (this.m_chr == null || !this.m_chr.IsInWorld) { return; } this.SendMailList(); })); }))); this.firstCheckSinceLogin = false; } else { MailHandler.SendMailList((IPacketReceiver)this.m_chr.Client, (IList <MailMessage>) this.CollectMail()); } }
public void Test() { // 生成操作对象实例 IHandler handler1 = new InternalHandler(); IHandler handler2 = new DiscountHandler(); IHandler handler3 = new MailHandler(); IHandler handler4 = new RegularHandler(); // 组装链式的结构 internal-> mail-> discount-> regular-> null handler1.Successor = handler3; handler3.Successor = handler2; handler2.Successor = handler4; IHandler head = handler1; Request request = new Request(20, PurchaseType.Mail); head.HandleRequest(request); Assert.AreEqual <double>(20 * 1.3, request.Price); // 重新组织链表结构 handler1.Successor = handler1.Successor.Successor; // 短路掉Discount request = new Request(20, PurchaseType.Discount); head.HandleRequest(new Request(20, PurchaseType.Discount)); Assert.AreEqual <double>(20, request.Price); // 确认被短路的部分无法生效 }
/** * 响应客户端请求系统邮件列表 * @param mailKind 邮件类型 * @param mailInfoDataList 邮件列表 */ public void GC_LOAD_MAIL_LIST(InputMessage data) { int i, size; int mailKind = data.GetInt(); ArrayList mailInfoDataList = new ArrayList(); size = data.GetShort(); for (i = 0; i < size; i++) { MailInfoData mailInfoDataList_Datas = new MailInfoData(); mailInfoDataList_Datas.mailId = data.GetLong(); mailInfoDataList_Datas.sendId = data.GetLong(); mailInfoDataList_Datas.sendName = data.GetString(); //发件角色名称 mailInfoDataList_Datas.mailCdTime = data.GetLong(); mailInfoDataList_Datas.hasAttachment = data.GetInt(); //是否有奖品未领取 mailInfoDataList_Datas.mailStatus = data.GetInt(); //邮件状态 mailInfoDataList_Datas.mailTitle = data.GetString(); //邮件标题 mailInfoDataList_Datas.mailCreatTime = data.GetLong(); mailInfoDataList_Datas.isFriendSend = data.GetInt(); //是否是好友发送的 0:是,1:否 mailInfoDataList_Datas.vipLevel = data.GetInt(); //vip等级 mailInfoDataList_Datas.headName = data.GetString(); //头像 mailInfoDataList.Add(mailInfoDataList_Datas); } MailHandler.Instance().GC_LOAD_MAIL_LIST(mailKind, mailInfoDataList); }
public ActionResult Index(FormCollection formCollection) { LetterToOfficial letterToOfficial = new LetterToOfficial { firstName = formCollection["FirstName"], lastName = formCollection["LastName"], email = formCollection["Email"], letter = formCollection["Letter"], emailSubject = formCollection["EmailSubject"], zipCode = formCollection["ZipCode"], officials = System.Text.RegularExpressions.Regex.Replace(formCollection["Officials"], @"\r\n+", " ") }; string[] officialsArray = null; // now split the contacts that are selected and loop officialsArray = letterToOfficial.officials.Split(','); string[] nameValuePair = null; for (int i = 0; i < officialsArray.Length - 1; i++) { nameValuePair = officialsArray[i].Split('|'); var thisEmail = nameValuePair[0]; var thisName = nameValuePair[1]; MailHandler thisMailer = new MailHandler(); thisMailer.SendEmail(letterToOfficial.email, thisEmail, letterToOfficial.emailSubject, letterToOfficial.letter); } // do we save the submitee to the database? return(View("ThankYou")); }
/// <summary> /// Returns the corresponding Item, if it can be mailed, else will send error message /// </summary> /// <param name="itemId"></param> /// <returns></returns> public Item GetItemToMail(EntityId itemId) { // Does the player have this item in their inventory? var item = m_chr.Inventory.GetItem(itemId); if (item == null) { MailHandler.SendResult(m_chr, 0u, MailResult.MailSent, MailError.INTERNAL_ERROR); return(null); } // If the item is a container, is it empty? if (item.IsContainer && !((Container)item).BaseInventory.IsEmpty) { MailHandler.SendResult(m_chr, 0u, MailResult.MailSent, MailError.BAG_FULL); return(null); } // Can't send conjured items or non-permanent items. if (item.IsConjured || item.Duration > 0) { MailHandler.SendResult(m_chr, 0u, MailResult.MailSent, MailError.INTERNAL_ERROR); return(null); } return(item); }
public static void SendMail(MailMessage letter) { // Make a new TextItem that contains the body of the message letter.ExpireTime = letter.DeliveryTime.AddDays(letter.CashOnDelivery > 0 ? MaxCODExpiryDelay : MailExpiryDelay); RealmServer.IOQueue.ExecuteInContext(() => { letter.Save(); // If the recipient is online, send them a new-mail notification var recipient = World.GetCharacter(letter.ReceiverId); if (recipient != null) { if (letter.DeliveryTime < DateTime.Now) { recipient.ExecuteInContext(() => { letter.Recipient = recipient.Record; recipient.MailAccount.AllMail.Add((uint)letter.Guid, letter); MailHandler.SendNotify(recipient.Client); }); } else { recipient.CallDelayed(letter.RemainingDeliveryMillis, chr => MailHandler.SendNotify(recipient.Client)); } } }); }
public bool SendMailGrupo(string grupoEvaluadores, int idEncuesta, int idGrupoEvaluado, string nombreEncuesta, string periodo) { try { string to = string.Empty, copy = string.Empty, subject = string.Empty, body = string.Empty; PersonaBL oBL = new PersonaBL(); List <int> GrupoEvaluadores = (grupoEvaluadores != null ? grupoEvaluadores.Split(',').Select(x => Convert.ToInt32(x)).ToList() : new List <int>()); foreach (var grupo in GrupoEvaluadores) { var personas = oBL.getPersonasPorGrupo(grupo); string host = getHost(); foreach (var persona in personas) { to = persona.Email; subject = "Encuesta : " + nombreEncuesta; var link = host + "/Admin/LlenarEncuesta?idEncuesta=" + idEncuesta + "&idGrupoEvaluado=" + idGrupoEvaluado + "&idEvaluador=" + persona.IdPersona; //body = "Estimado " + persona.Nombre + ",<br/>se ha abierto la encuesta " + nombreEncuesta + " para el Periodo " + periodo + //", sirvase a contestar la encuesta a traves de este enlace:<br/>" + link + "<br/>Atentamente,<br/>La Administración."; body = cuerpoCorreo(persona.Nombre, nombreEncuesta, periodo, link); MailHandler.Send(to, copy, subject, body); } } return(true); } catch (Exception) { return(false); } }
public static void SendMail(MailMessage letter) { letter.ExpireTime = letter.DeliveryTime.AddDays(letter.CashOnDelivery > 0U ? (double)MailMgr.MaxCODExpiryDelay : (double)MailMgr.MailExpiryDelay); ServerApp <WCell.RealmServer.RealmServer> .IOQueue.ExecuteInContext((Action)(() => { letter.Save(); Character recipient = World.GetCharacter(letter.ReceiverId); if (recipient == null) { return; } if (letter.DeliveryTime < DateTime.Now) { recipient.ExecuteInContext((Action)(() => { letter.Recipient = recipient.Record; recipient.MailAccount.AllMail.Add((uint)letter.Guid, letter); MailHandler.SendNotify(recipient.Client); })); } else { recipient.CallDelayed(letter.RemainingDeliveryMillis, (Action <WorldObject>)(chr => MailHandler.SendNotify(recipient.Client))); } })); }
public void SendMailList() { if (firstCheckSinceLogin) { // enqueue Task to load from DB // then enqueue another task to do the actual sending from the Map thread RealmServer.IOQueue.AddMessage(new Message(() => { Load(); var context = m_chr.ContextHandler; if (context != null) { context.AddMessage(() => { if (m_chr != null && m_chr.IsInWorld) { SendMailList(); } }); } })); firstCheckSinceLogin = false; } else { var list = CollectMail(); MailHandler.SendMailList(m_chr.Client, list); } }
/// <summary> /// Initialization /// </summary> protected override void OnOpen(TimeSpan timeout) { // Get a mail handler object from the binding pMailHandler = EmailBindingElement.GetRaspMailHandlerFromBindingContext(pContext); pMailHandler.OnExceptionThrown += new MailboxExceptionThrown(CallbackMailExceptionThrown); pMailHandler.OnInboxStateChange += new OnInboxStateChangeDelegate(CallbackOnInboxStateChange); }
public bool Check(Parcel parcel, MailHandler handler) { return(MinWeightCriteriaCheck(handler, parcel) && MaxWeightCriteriaCheck(parcel, handler) && MinValueCriteriaCheck(handler, parcel) && MaxValueCriteriaCheck(parcel, handler) && SignedOffCriteriaCheck(parcel, handler)); }
public void SendMailPassRecovery(UsuarioDTO user, string passChange) { string to = user.Email; string subject = "Recuperación de Contraseña"; string body = "Sr(a). " + user.Nombre + " su contraseña es : " + passChange; MailHandler.Send(to, "", subject, body); }
public void HandleRequest(IRequest request) { var folder = request.Data.GetOrDefault <int>(k.folder); var character = request.Session.Character; var result = MailHandler.ListMails(character, folder).ToDictionary("m", m => m.toDictionary()); Message.Builder.FromRequest(request).WithData(result).Send(); }
public void HandleRequest(IRequest request) { var character = request.Session.Character; var result = new Dictionary <string, object> { { k.amount, MailHandler.NewMailCount(character) } }; Message.Builder.FromRequest(request).WithData(result).Send(); }
/// <summary> /// OnCreateChannel event /// </summary> /// <param name="address"></param> /// <param name="via"></param> /// <returns></returns> protected override IRequestChannel OnCreateChannel(System.ServiceModel.EndpointAddress address, Uri via) { // Get a mail handler object from the binding MailHandler mailHandler = EmailBindingElement.GetRaspMailHandlerFromBindingContext(pBindingContext); mailHandler.OnExceptionThrown += new MailboxExceptionThrown(mailHandler_OnExceptionThrown); // Create the channel return(new EmailRequestChannel(mailHandler, address, this)); }
/** * 用户发送完邮件 成功之后 返回展示信息 * @param sendId 发送人ID * @param sendName 发送人名称 * @param receiveId 收件人ID * @param receiveName 收件人 名称 * @param gold 礼物价值 * @param sendTime 赠送时间 */ public void GC_SEND_FINISH(InputMessage data) { long sendId = data.GetLong(); string sendName = data.GetString(); long receiveId = data.GetLong(); string receiveName = data.GetString(); long gold = data.GetLong(); long sendTime = data.GetLong(); MailHandler.Instance().GC_SEND_FINISH(sendId, sendName, receiveId, receiveName, gold, sendTime); }
public string sendEmail(string userid, string fromname, string email, string subject, string message) { ProfileServices pf = new ProfileServices(); string userEmail = pf.getUserEmailUsingScreenName(userid); MailHandler oH = new MailHandler(); oH.SendMailUser(userEmail, fromname, email, subject, message); return(""); }
public bool SendEmailContacto(ContactoDTO contacto) { try { MailHandler.Send2(contacto.Correo, contacto.Asunto, contacto.Mensaje, contacto.Nombres, contacto.Copia); return(true); } catch (Exception) { return(false); } }
public void HandleRequest(IRequest request) { using (var scope = Db.CreateTransaction()) { var character = request.Session.Character; var folder = request.Data.GetOrDefault <int>(k.folder); MailHandler.DeleteFolder(character, folder); Message.Builder.FromRequest(request).WithOk().Send(); scope.Complete(); } }
public JsonResult EnviarComentario(string Nombre, string Telefono, string CorreoElectronico, string Comentario) { try { MailHandler.SendEmailToCamajanSport("Formulario de Contacto", CorreoElectronico, "Usted ha recibido el siguiente comentario:<br/><br/>Nombre:" + Nombre + "<br/>Correo Electrónico:" + CorreoElectronico + "<br/><br/>Comentario:<br/><br/>" + Comentario); return(Json(new { Result = "OK", Type = "success", Message = "Su comentario se ha enviado satisfactoriamente." })); } catch (Exception) { return(Json(new { Result = "ERROR", Type = "error", Message = "Ha ocurrido un error al enviar su comentario, si el problema persiste contacte el administrador." })); } }
public void HandleRequest(IRequest request) { using (var scope = Db.CreateTransaction()) { var mailId = request.Data.GetOrDefault <string>(k.ID); var character = request.Session.Character; var mail = MailHandler.OpenMail(character, mailId); Message.Builder.FromRequest(request).WithData(mail.toDictionary()).WrapToResult().Send(); scope.Complete(); } }
public void SendStateEmail(IDA da, MailHandler mail, DbNeighborhood nhood, DbElectionCycle cycle, uint avatarID) { if (!da.Elections.TryRegisterMail(new DbElectionCycleMail() { avatar_id = avatarID, cycle_id = cycle.cycle_id, cycle_state = cycle.current_state })) { return; } var endDate = cycle.end_date; switch (cycle.current_state) { case DbElectionCycleState.nomination: endDate -= 60 * 60 * 24 * 3; //nomination ends 3 days before end of cycle mail.SendSystemEmail("f116", (int)NeighMailStrings.NominateSubject, (int)NeighMailStrings.Nominate, 1, MessageSpecialType.Nominate, endDate, avatarID, nhood.name, endDate.ToString()); break; case DbElectionCycleState.election: mail.SendSystemEmail("f116", (int)NeighMailStrings.VoteSubject, (int)NeighMailStrings.Vote, 1, MessageSpecialType.Vote, endDate, avatarID, nhood.name, endDate.ToString()); break; case DbElectionCycleState.failsafe: mail.SendSystemEmail("f116", (int)NeighMailStrings.FailsafeSubject, (int)NeighMailStrings.Failsafe, 1, MessageSpecialType.Normal, endDate, avatarID, nhood.name); break; case DbElectionCycleState.shutdown: if (Context.Config.Neighborhoods.Election_Free_Vote) { mail.SendSystemEmail("f116", (int)NeighMailStrings.FreeVoteSubject, (int)NeighMailStrings.FreeVote, 1, MessageSpecialType.FreeVote, endDate, avatarID, nhood.name, endDate.ToString()); } break; case DbElectionCycleState.ended: var winner = da.Avatars.Get(nhood.mayor_id ?? 0)?.name; if (winner == null) { return; } mail.SendSystemEmail("f116", (int)NeighMailStrings.ElectionOverSubject, (int)NeighMailStrings.ElectionOver, 1, MessageSpecialType.Normal, endDate, avatarID, winner, nhood.name, "someone else idk"); break; } }
/** * 一键领取邮件返回 * @param mailIdList 邮件Id列表 */ public void GC_RECEIVE_ALL(InputMessage data) { int i, size; ArrayList mailIdList = new ArrayList(); size = data.GetShort(); for (i = 0; i < size; i++) { long mailIdList_Datas = data.GetLong(); mailIdList.Add(mailIdList_Datas); } MailHandler.Instance().GC_RECEIVE_ALL(mailIdList); }