/// <summary> /// Executes the job. /// </summary> /// <param name="context">The job execution context.</param> public virtual void Execute(IJobExecutionContext context) { JobDataMap data = context.MergedJobDataMap; MailMessage message = BuildMessageFromParameters(data); try { string portString = GetOptionalParameter(data, PropertySmtpPort); int? port = null; if (!string.IsNullOrEmpty(portString)) { port = Int32.Parse(portString); } var info = new MailInfo { MailMessage = message, SmtpHost = GetRequiredParameter(data, PropertySmtpHost), SmtpPort = port, SmtpUserName = GetOptionalParameter(data, PropertyUsername), SmtpPassword = GetOptionalParameter(data, PropertyPassword), }; Send(info); } catch (Exception ex) { throw new JobExecutionException(string.Format(CultureInfo.InvariantCulture, "Unable to send mail: {0}", GetMessageDescription(message)), ex, false); } }
/// <summary> /// 点击邮件Item /// </summary> void OnItemClick(GameObject obj) { chooseMailInfo = obj.GetComponentInParent <UIGridItem>().oData as MailInfo; MailProxy.Instance.ReadMail(chooseMailInfo); chooseMailInfo.state = 0; m_Panel.emailGrid.UpdateCustomData(chooseMailInfo); ClickComBtn(Click_Type.READ_MAIL); }
protected override void Send(MailInfo info) { actualMailSent = info.MailMessage; actualSmtpHost = info.SmtpHost; actualSmtpUserName = info.SmtpUserName; actualSmtpPassword = info.SmtpPassword; actualSmtpPort = info.SmtpPort; }
public void OnReceivingDataStream(object sender, MailInfo info, int received, int total, ref bool cancel) { pgBar.Minimum = 0; pgBar.Maximum = total; pgBar.Value = received; cancel = m_bcancel; Application.DoEvents(); }
static int InitWithJson(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); MailInfo obj = (MailInfo)LuaScriptMgr.GetUnityObjectSelf(L, 1, "MailInfo"); JSONObject arg0 = (JSONObject)LuaScriptMgr.GetNetObject(L, 2, typeof(JSONObject)); obj.InitWithJson(arg0); return(0); }
public bool UpdateAsync(MailInfo model) { if (model == null) { throw new ArgumentNullException("model不能为null"); } return(_mailInfoRepository.UpdateAsync(model)); }
public async Task DequeueMailInfo([QueueTrigger("mail", Connection = "ConnectionString")] string queueItem, ILogger log) { log.EnterJson("{0}", queueItem); try { // アプリケーション設定でメール本文フォーマットが設定されていない場合、実行時にエラーとする if (string.IsNullOrEmpty(_settings.MailTextFormat)) { throw new RmsInvalidAppSettingException($"{nameof(_settings.MailTextFormat)} is required."); } // Sq1.1.1: メール送信データを生成する MailInfo mailInfo = JsonConvert.DeserializeObject <MailInfo>(queueItem); // バリデーション Validator.ValidateObject(mailInfo, new ValidationContext(mailInfo, null, null)); // Sq1.1.2: メール送信を依頼する if (await _service.SendMail(mailInfo)) { // メール送信依頼完了 log.Info(nameof(Resources.OP_MLS_MLS_003)); } else { // 失敗した場合はFailureストレージに書き込み _service.UpdateToFailureStorage(queueItem); } } catch (ValidationException e) { // キューフォーマット異常 log.Error(e, nameof(Resources.OP_MLS_MLS_005), new object[] { e.Message }); // 失敗した場合はFailureストレージに書き込み _service.UpdateToFailureStorage(queueItem); } catch (RmsInvalidAppSettingException e) { log.Error(e, nameof(Resources.OP_MLS_MLS_006), new object[] { e.Message }); // 失敗した場合はFailureストレージに書き込み _service.UpdateToFailureStorage(queueItem); } catch (Exception e) { log.Error(e, nameof(Resources.OP_MLS_MLS_001)); // 失敗した場合はFailureストレージに書き込み _service.UpdateToFailureStorage(queueItem); } finally { log.Leave(); } }
public static bool SendMail(MailInfo mailInfo) { using (var mail = new MailMessage()) { //mail.From = new MailAddress(mailInfo.MailAccount.Username); mail.Subject = mailInfo.Subject; mail.IsBodyHtml = mailInfo.IsBodyHtml; mail.Priority = MailPriority.High; if (!string.IsNullOrEmpty(mailInfo.Body)) { mail.Body = mailInfo.Body; } if (mailInfo.AlternateView != null) { mail.AlternateViews.Add(mailInfo.AlternateView); } if (mailInfo.To != null && mailInfo.To.Any()) { foreach (var to in mailInfo.To) { mail.To.Add(to); } } if (mailInfo.Cc != null && mailInfo.Cc.Any()) { foreach (var cc in mailInfo.Cc) { mail.CC.Add(cc); } } if (mailInfo.Bcc != null && mailInfo.Bcc.Any()) { foreach (var bcc in mailInfo.Bcc) { mail.CC.Add(bcc); } } if (mailInfo.FileAttachmentInfos != null && mailInfo.FileAttachmentInfos.Any()) { foreach (var fileAttachmentInfo in mailInfo.FileAttachmentInfos) { mail.Attachments.Add(new Attachment(fileAttachmentInfo.FileStream, fileAttachmentInfo.FileName)); } } var smtp = new SmtpClient(); smtp.Send(mail); return(true); } }
public bool HandleCommand(TankHotSpringLogicProcessor process, GamePlayer player, GSPacketIn packet) { if (player.CurrentHotSpringRoom != null) { int num = packet.ReadInt(); if (num <= 0) { return(false); } if (player.PlayerCharacter.Money >= num) { player.RemoveMoney(num); LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_Gift, player.PlayerCharacter.ID, num, player.PlayerCharacter.Money, 0, 0, 0, "", "", ""); using (PlayerBussiness bussiness = new PlayerBussiness()) { string translation = LanguageMgr.GetTranslation("LargessCommand.Content", new object[] { player.PlayerCharacter.NickName, num / 2 }); string str2 = LanguageMgr.GetTranslation("LargessCommand.Title", new object[] { player.PlayerCharacter.NickName }); MailInfo mail = new MailInfo { Annex1 = "", Content = translation, Gold = 0, IsExist = true, Money = num / 2, Receiver = player.CurrentHotSpringRoom.Info.playerName, ReceiverID = player.CurrentHotSpringRoom.Info.playerID, Sender = LanguageMgr.GetTranslation("LargessCommand.Sender", new object[0]), SenderID = 0, Title = str2, Type = 14 }; bussiness.SendMail(mail); player.Out.SendMailResponse(mail.ReceiverID, eMailRespose.Receiver); MailInfo info2 = new MailInfo { Annex1 = "", Content = translation, Gold = 0, IsExist = true, Money = num / 2, Receiver = player.CurrentHotSpringRoom.Info.GroomName, ReceiverID = player.CurrentHotSpringRoom.Info.GroomID, Sender = LanguageMgr.GetTranslation("LargessCommand.Sender", new object[0]), SenderID = 0, Title = str2, Type = 14 }; bussiness.SendMail(info2); player.Out.SendMailResponse(info2.ReceiverID, eMailRespose.Receiver); } player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("LargessCommand.Succeed", new object[0])); GSPacketIn @in = player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("LargessCommand.Notice", new object[] { player.PlayerCharacter.NickName, num })); player.CurrentHotSpringRoom.SendToPlayerExceptSelf(@in, player); return(true); } player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("UserFirecrackersCommand.MoneyNotEnough", new object[0])); } return(false); }
private void UpdateMailDrawMark2HasDraw(long uid) { MailInfo mailInfo = this.FindMailInfoByUID(uid); if (mailInfo != null) { mailInfo.drawMark = 0; } }
static void Main(string[] args) { // Create a folder named "inbox" under current directory string curpath = Directory.GetCurrentDirectory(); string mailbox = String.Format("{0}\\inbox", curpath); // If the folder is not existed, create it. if (!Directory.Exists(mailbox)) { Directory.CreateDirectory(mailbox); } MailServer oServer = new MailServer("pop3.live.com", "email", "pass", ServerProtocol.Pop3); MailClient oClient = new MailClient("TryIt"); // Enable SSL connection. oServer.SSLConnection = true; // Set 995 SSL port oServer.Port = 995; try { oClient.Connect(oServer); MailInfo[] infos = oClient.GetMailInfos(); for (int i = 0; i < infos.Length; i++) { MailInfo info = infos[i]; Console.WriteLine("Index: {0}; Size: {1}; UIDL: {2}", info.Index, info.Size, info.UIDL); // Receive email from POP3 server Mail oMail = oClient.GetMail(info); Console.WriteLine("From: {0}", oMail.From.ToString()); Console.WriteLine("Subject: {0}\r\n", oMail.Subject); // Generate an email file name based on date time. System.DateTime d = System.DateTime.Now; System.Globalization.CultureInfo cur = new System.Globalization.CultureInfo("pt-PT"); string sdate = d.ToString("yyyyMMddHHmmss", cur); string fileName = String.Format("{0}\\{1}{2}{3}.eml", mailbox, sdate, d.Millisecond.ToString("d3"), i); // Save email to local disk oMail.SaveAs(fileName, true); Console.Write("Novo email\n"); Console.Write(""); // Mark email as deleted from POP3 server. //oClient.Delete(info); } oClient.Quit(); } catch (Exception ep) { Console.WriteLine(ep.Message); } }
public void Initialize(MailInfo info) { this.info = info; TDataMailInfo data; if (TableManager.Get().MailInfo.GetData(info.mailTableId, out data)) { string countryCode = "EN"; switch (ObscuredPrefs.GetString("CountryCode", "EN")) { case "KO": countryCode = "kr"; break; default: countryCode = "en"; break; } string sender = $"mailSender_{countryCode}"; string title = $"mailTitle_{countryCode}"; string text = $"mailText_{countryCode}"; Debug.Log("======= Mail info ======"); //foreach (var member in data.GetType().GetProperty(sender).GetValue(data)) { text_From.text = $"From: {data.GetType().GetProperty(sender)?.GetValue(data)}"; text_Title.text = data.GetType().GetProperty(title)?.GetValue(data).ToString(); } // Item setting if (info.mailItems != null && info.mailItems.Length > 0) { int id = info.mailItems[0].ItemId; int value = info.mailItems[0].Value; TDataItemList itemData; if (TableManager.Get().ItemList.GetData(id, out itemData)) { image_ItemIcon.sprite = FileHelper.GetIcon(itemData.itemIcon); text_ItemCount.text = $"x{value}"; } else { btn_Item.gameObject.SetActive(false); } } else { btn_Item.gameObject.SetActive(false); } } else { Destroy(gameObject); } }
public void EndRaid(bool finished = false) { // End the raid Started = false; if (CurrentMap.Players.Count > 0) { int[] rewards = new int[CurrentMap.Players.Count]; for (int i = 0; i < rewards.Length; i++) { rewards[i] = Envir.Random.Next(0, Info.ItemRewards.Count); } PlayerStats = PlayerStats.OrderBy(o => o.DamageDealt).ToList(); PlayerStats.Reverse(); for (int i = CurrentMap.Players.Count - 1; i >= 0; i--) { if (!CurrentMap.Players[i].Dead) { if (finished) { for (int x = 0; x < PlayerStats.Count; x++) { if (rewards[x] == -1) { continue; } if (PlayerStats[x].PlayerName == CurrentMap.Players[i].Name) { UserItem item = CreateRaidItem(rewards[x], CurrentMap.Players[i].Class); List <UserItem> items = new List <UserItem> { item }; if (item != null) { rewards[x] = -1; MailInfo mail = new MailInfo(CurrentMap.Players[i].Info.Index) { Items = items, Message = string.Format("You were awarded {0} for your efforts in the raid", item.FriendlyName), MailID = ++Envir.NextMailID, Sender = string.Format("Raid{0}", Info.Index) }; mail.Send(); } } } CurrentMap.Players[i].ReceiveChat(string.Format("All monsters have been banished!"), ChatType.System); } CurrentMap.Players[i].Teleport(Envir.GetMap(CurrentMap.Players[i].BindMapIndex), CurrentMap.Players[i].BindLocation); } } } Envir.Broadcast(new ServerPackets.Chat { Message = string.Format("{0} raid has finished!", Info.Title) }); }
public void IsProcessにより処理対象かどうかを判断する(double threadSpan, bool expected) { //setUp var sut = new MailInfo(_dfFile); //exercise var actual = sut.IsProcess(threadSpan, _dfFile); //verify Assert.That(actual, Is.EqualTo(expected)); }
public void プロパティによる値取得(string tag, string expected) { //setUp var sut = new MailInfo(_dfFile); //exercise var actual = sut.GetType().GetProperty(tag).GetValue(sut, null).ToString(); //verify Assert.That(actual, Is.EqualTo(expected)); }
public void SendMail(MailInfo mailInfo) { var helper = new WebAPIHelper(); var result = helper.Post <Stream>("SendMail", mailInfo); if (result != null) { result.Dispose(); } }
public ActionResult Index() { MailInfo model = _mailInfoService.GetInfoAsync(); if (model == null) { model = new MailInfo(); } return(View(model)); }
private void UpdateMailStatus2HasOpen(long uid) { MailInfo mailInfo = this.FindMailInfoByUID(uid); if (mailInfo != null) { mailInfo.status = 1; } this.CheckMailReadTip(); }
public int HandlePacket(GameClient client, GSPacketIn packet) { //已经开始游戏则不处理 if (client.Player.CurrentRoom != null && client.Player.CurrentRoom.IsPlaying) { return(0); } int bagType = packet.ReadByte(); int index = packet.ReadInt(); PlayerInventory bag = client.Player.GetInventory((eBageType)bagType); ItemInfo item = bag.GetItemAt(index); if (item != null && !item.IsValidItem()) { if (bagType == 0 && index < 11) { int place = bag.FindFirstEmptySlot(31); if (place != -1) { bag.RemoveItem(item); //bag.MoveItem(item.Place, place); } else { using (PlayerBussiness pb = new PlayerBussiness()) { MailInfo mail = new MailInfo(); mail.Annex1 = item.ItemID.ToString(); mail.Content = LanguageMgr.GetTranslation("ItemOverdueHandler.Content"); mail.Gold = 0; mail.IsExist = true; mail.Money = 0; mail.Receiver = client.Player.PlayerCharacter.NickName; mail.ReceiverID = item.UserID; mail.Sender = client.Player.PlayerCharacter.NickName; mail.SenderID = item.UserID; mail.Title = LanguageMgr.GetTranslation("ItemOverdueHandler.Title"); mail.Type = (int)eMailType.ItemOverdue; if (pb.SendMail(mail)) { //item.UserID = 0; bag.RemoveItem(item); } } } } else { bag.UpdateItem(item); } } return(0); }
/// <summary> /// Funzione che effettua la scansione della cartella delle pec in errore e rielabora i tentativi falliti /// </summary> private void Scan() { try { Dictionary <string, bool> filesToElaborate = Directory.GetFiles(_errorFolder) .Where(filePath => ThresholdIsValid(filePath) && OtherHalfExists(filePath)) .ToDictionary(x => x, x => false); while (filesToElaborate.Any(x => !x.Value)) { Guid correlationId = Guid.NewGuid(); //mi prendo il primo (prossimo) eml da elaborare string currentEmlPath = filesToElaborate.First(x => x.Key.EndsWith(EmlExtension)).Key; //cerco il suo file info string currentXmlPath = filesToElaborate.First(x => x.Key.EndsWith(OtherHalfName(currentEmlPath))).Key; MailInfo mailInfo = MailInfo.Load(currentXmlPath); PECMailErrorSummaryModel summaryModel = new PECMailErrorSummaryModel() { CorrelatedId = correlationId, ProcessedErrorMessages = string.Join(Environment.NewLine, mailInfo.Errors), Subject = mailInfo.Subject, Body = mailInfo.Body, Sender = mailInfo.Sender, Recipients = mailInfo.Recipients, ReceivedDate = mailInfo.Date, Priority = mailInfo.Priority, }; PECMailErrorStreamModel streamModel = new PECMailErrorStreamModel() { CorrelatedId = correlationId, Stream = File.ReadAllBytes(currentEmlPath) }; //gli segno come elaborati anche se magari la richiesta all api schianta, perche' non posso processari gli stessi all infinito, ma gli riprocesso al prossimo scan filesToElaborate[currentXmlPath] = true; filesToElaborate[currentEmlPath] = true; bool requestWasSuccessfull = CallWebApi(summaryModel, streamModel); if (requestWasSuccessfull) { File.Delete(currentEmlPath); File.Delete(currentXmlPath); } } } catch (Exception e) { FileLogger.Error(_moduleName, $"Error occured: {e.Message}"); } }
/// <summary> /// 群发邮件 /// </summary> public bool SendAllItemsToMail(string sender, string title, eMailType type) { if (m_saveToDb) { BeginChanges(); try { using (PlayerBussiness pb = new PlayerBussiness()) { lock (m_lock) { List <ItemInfo> items = GetItems(); int count = items.Count; for (int i = 0; i < count; i += 5) { MailInfo mail = new MailInfo(); mail.SenderID = 0; mail.Sender = sender; mail.ReceiverID = m_player.PlayerCharacter.ID; mail.Receiver = m_player.PlayerCharacter.NickName; mail.Title = title; mail.Type = (int)type; mail.Content = ""; List <ItemInfo> list = new List <ItemInfo>(); for (int j = 0; j < 5; j++) { int index = i * 5 + j; if (index < items.Count) { list.Add(items[index]); } } if (SendItemsToMail(list, mail, pb) == false) { return(false); } } } } } catch (Exception ex) { Console.WriteLine("Send Items Mail Error:" + ex); } finally { SaveToDatabase(); CommitChanges(); } m_player.Out.SendMailResponse(m_player.PlayerCharacter.ID, eMailRespose.Receiver); } return(true); }
public int HandlePacket(GameClient client, GSPacketIn packet) { int num = packet.ReadInt(); int receiebox = packet.ReadInt(); packet.ReadInt(); packet.ReadInt(); bool result = false; List <ItemInfo> list = new List <ItemInfo>(); int iD = client.Player.PlayerCharacter.ID; int receiebox2 = client.Player.PlayerCharacter.receiebox; string message = "Nhận rương thời gian thành công!"; switch (num) { case 0: client.Player.UpdateTimeBox(receiebox, 20, 0); client.Out.SendGetBoxTime(iD, receiebox2, result); break; case 1: result = true; list = ItemBoxMgr.GetItemBoxAward(ItemMgr.FindItemBoxTemplate(receiebox2).TemplateID); foreach (ItemInfo current in list) { if (!client.Player.AddTemplate(current, current.Template.BagType, current.Count)) { using (PlayerBussiness playerBussiness = new PlayerBussiness()) { current.UserID = 0; playerBussiness.AddGoods(current); MailInfo mailInfo = new MailInfo(); mailInfo.Annex1 = current.ItemID.ToString(); mailInfo.Content = "Phần thưởng từ rương thời gian."; mailInfo.Gold = 0; mailInfo.Money = 0; mailInfo.Receiver = client.Player.PlayerCharacter.NickName; mailInfo.ReceiverID = client.Player.PlayerCharacter.ID; mailInfo.Sender = mailInfo.Receiver; mailInfo.SenderID = mailInfo.ReceiverID; mailInfo.Title = "Mở rương thời gian!"; mailInfo.Type = 12; playerBussiness.SendMail(mailInfo); message = "Túi đã đầy, vật phẩm đã được chuyển vào thư!"; } client.Out.SendMailResponse(client.Player.PlayerCharacter.ID, eMailRespose.Receiver); } } client.Out.SendGetBoxTime(iD, receiebox2, result); client.Out.SendMessage(eMessageType.Normal, message); break; } return(0); }
//成功失败次数直接封装 /// <summary> /// 最新编辑邮件模板 /// </summary> /// <param name="projectInfo"></param> /// <param name="statisticsTimes"></param> /// <param name="mailPath"></param> /// <param name="shortName"></param> /// <returns></returns> public MailInfo NewEditBody(ProjectInfo projectInfo, string[] statisticsTimes, string mailPath, string shortName) { string path = string.Empty; System.IO.StreamReader sr = new System.IO.StreamReader(mailPath); string body = string.Empty; body = sr.ReadToEnd(); MailInfo mailInfo = new MailInfo(); try { //计算个人本周编译次数,成功失败次数,以及其所占有的比率 double successRate = double.Parse(statisticsTimes[2]) / double.Parse(statisticsTimes[1]); double failureRate = double.Parse(statisticsTimes[3]) / double.Parse(statisticsTimes[1]); var emoji = projectInfo.Result == "successful" ? Encoding.UTF8.GetString(new byte[] { 0xF0, 0x9F, 0x98, 0x83 }) : Encoding.UTF8.GetString(new byte[] { 0xF0, 0x9F, 0x91, 0xBF }); var header = emoji + projectInfo.Nameproperty + " reversion " + ((projectInfo.ProjectType == "git") ? (projectInfo.GitVersion.Substring(0, 8)) : projectInfo.GitVersion) + " build " + projectInfo.Result + ". This week " + projectInfo.Author + " build " + statisticsTimes[1] + " times, " + statisticsTimes[2] + " passed, " + statisticsTimes[3] + " failed."; body = body.Replace("$PROJECTNAME$", projectInfo.Nameproperty); body = body.Replace("$LOG$", projectInfo.Log); body = body.Replace("$VERSION$", projectInfo.Revision); body = body.Replace("$AUTHOR$", projectInfo.Author); body = body.Replace("$DATE$", projectInfo.Changetime); body = body.Replace("$RESULT$", "build " + projectInfo.Result); body = body.Replace("$DURATION$", projectInfo.Duration); body = body.Replace("$SERVER_VERSION$", "Send by LuckyCI v" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()); body = projectInfo.Log == "\n" ? body.Replace("$LOGLABEL$", "") : body.Replace("$LOGLABEL$", "Build Log"); mailInfo.Subject = header; mailInfo.Body = body; mailInfo.Mailto = projectInfo.MailTo; mailInfo.Host = projectInfo.MailHost; if (projectInfo.UserName.Contains("#author#")) { mailInfo.Mailfrom = (shortName != "") ? (shortName + Regex.Match(projectInfo.UserName, "(?:@)(.+)").Value) : (projectInfo.Author + Regex.Match(projectInfo.UserName, "(?:@)(.+)").Value); } else { mailInfo.Mailfrom = projectInfo.UserName.Replace("#", ""); mailInfo.Mailpassword = projectInfo.Password; } return(mailInfo); } catch (Exception ex) { return(mailInfo); } }
public static void MarcarLeidoNoLeido(MailClient client, MailInfo mailInfo, bool asRead = true) { try { client.MarkAsRead(mailInfo, asRead); } catch (Exception ex) { throw new Exception(ex.Message); } }
public void ToStringによる文字列化() { //setUp var sut = new MailInfo(_dfFile); var expected = "from:[email protected] to:[email protected] size:310 uid:bjd.00634712193942765633.000"; //exercise var actual = sut.ToString(); //verify Assert.That(actual, Is.EqualTo(expected)); }
public int UpDate(MailInfo mail) { try { return(SqliteHelper.ExecuteNoQuery(System.Data.CommandType.Text, "update hm_mailinfo set UserId = @UserId FromAddress = @FromAddress,ToAddress = @ToAddress,Cc = @Cc,Bcc = @Bcc,Subject = @Subject,DownloadDate = @DownloadDate,ReceiveDate = @ReceiveDate,Type=@Type where Id = @Id", Parameter(mail))); } catch { return(-1); } }
protected void BtnSend_Click(object sender, EventArgs e) { int num = 0; int num2 = 0; string temp = "<html>\n<title></title>\n<body>\n<TABLE border=0 width='100%' align=center>\n<TBODY>\n<TR>\n<TD valign=middle align=top>\n内容\n<center><font color=red>签名</font>\n</TD></TR></TBODY></TABLE><br><hr width=100% size=1>\n</body>\n</html>"; //DataSecurity.HtmlDecode( mm.MailAddTime = DateTime.Now; mm.MailContext = temp.Replace("内容", this.HiddenField1.Value).Replace("签名", this.ddlMailIdiograph.SelectedValue); mm.MailTitle = this.TxtSubject.Text; mm.MailAddRees = this.txtSend.Text; if (rblSendType.SelectedIndex == 0)//立即发送 { string[] userData = this.txtSend.Text.Split(new char[] { ',' }); if (userData != null) { if (userData.Length <= 0) { function.WriteErrMsg("没有获得会员邮件地址信息"); } MailInfo mailInfo = this.GetMailInfo(); foreach (string strArray in userData) { if (DataValidator.IsEmail(strArray)) { mailInfo.ToAddress = new MailAddress(strArray, null); if (SendMail(strArray)) //if (SendMail.Send(mailInfo) == MailState.Ok) { num++; } else { num2++; } } } mm.MailState = true; mm.MailSendTime = DateTime.Now; bm.GetInsert(mm); function.WriteSuccessMsg("发送成功" + num.ToString() + "封邮件,发送失败" + num2.ToString() + "封邮件", "../SendMailList.aspx"); } } else//定时发送 { mm.MailState = false; mm.MailSendTime = DateTime.Parse(this.txtSendTime.Text + " " + ddlHour.SelectedValue + ":" + ddlMinute.SelectedValue + ":00"); runlist.AddMail(mm); bm.GetInsert(mm); } function.WriteSuccessMsg("邮件信息已经成功添加!", "../SendMailList.aspx"); }
public IActionResult Email_SendEmail() { CheckNum = function.GetRandomString(8).ToLower(); string mailcontent = "您好,您正在<a href='" + SiteConfig.SiteInfo.SiteUrl + "'>" + SiteConfig.SiteInfo.SiteName + "</a>网站修改邮箱,您本次的验证码为:" + CheckNum; MailInfo mailInfo = SendMail.GetMailInfo(mu.Email, SiteConfig.SiteInfo.SiteName, "修改邮箱[" + SiteConfig.SiteInfo.SiteName + "]", mailcontent); SendMail.Send(mailInfo); ShowMsg("注册验证码已成功发送到你的注册邮箱,<a href='" + B_Plat_Common.GetMailSite(mu.Email) + "' target='_blank'>请前往邮箱查收并验证</a>!", "info"); ViewBag.email = mu.Email; return(View("Email")); }
public void InsertMailButton(MailInfo mailInfo) { var mail = Instantiate(GameMailInfo); var mailInformation = mail.GetComponent <MailInformation>(); mailInformation.Init(mailInfo); Debug.Log(mailInfo); mail.transform.SetParent(GameObject.Find("Contents").transform); }
public MessageList(string folder) { string[] files = Directory.GetFiles(folder, "DF_*"); Array.Sort(files);//ファイル名をソート(DF_名は作成日付なので、結果的に日付順となる)FAT32対応 foreach (string fileName in files) { var mailInfo = new MailInfo(fileName); string fname = Path.GetFileName(fileName); Add(new OneMessage(folder, fname.Substring(3), mailInfo.Uid, mailInfo.Size)); } }
/// <summary> /// メールを送信する(スタブ) /// </summary> /// <param name="mailInfo">メール情報</param> /// <returns>メール送信結果(HTTPステータスコードとレスポンスボディ)</returns> public async Task <KeyValuePair <HttpStatusCode, string> > SendMail(MailInfo mailInfo) { if (responseException != null) { throw responseException; } mails.Add(mailInfo); return(new KeyValuePair <HttpStatusCode, string>(responseCode, string.Format("status code is {0}.", responseCode))); }
protected virtual void Send(MailInfo mailInfo) { log.Info(string.Format(CultureInfo.InvariantCulture, "Sending message {0}", GetMessageDescription(mailInfo.MailMessage))); var client = new SmtpClient(mailInfo.SmtpHost); if (mailInfo.SmtpUserName != null) { client.Credentials = new NetworkCredential(mailInfo.SmtpUserName, mailInfo.SmtpPassword); } if (mailInfo.SmtpPort != null) { client.Port = mailInfo.SmtpPort.Value; } // Do not remove this using. In .NET 4.0 SmtpClient implements IDisposable. using (client as IDisposable) { client.Send(mailInfo.MailMessage); } }
/// <summary> /// Fetch Mail Header for a list of UIDs (or IDs). /// </summary> /// <param name="ids"> /// Depending on <see cref="EnableUidCommands"/> this is an array of UIDs /// (<c>true</c>) or IDs (<c>false</c>). /// </param> /// <param name="what"> /// A list of IMap items to be returned. If empty or null the default is: /// "<c>(UID FLAGS RFC822.SIZE BODY.PEEK[HEADER])</c>". /// </param> /// <returns> /// An array of mail headers (may be zero-sized) or <c>null</c> on error. /// </returns> /// <remarks> /// This method is used by <see cref="MailSearch(string, string, string[])"/>. /// It is recommended to set <see cref="EnableUidCommands"/> to <c>true</c>. /// </remarks> public MailInfo[] MailHeaders(uint[] ids, string what) { if(factory == null || ids == null) return null; if(ids.Length <= 0) return new MailInfo[0]; if(string.IsNullOrEmpty(what)) what = "UID FLAGS RFC822.SIZE BODY.PEEK[HEADER]"; ZIMapCommand.Fetch fetch = new ZIMapCommand.Fetch(factory); if(fetch == null) return null; progress.Update(0); fetch.UidCommand = enableUid; uint count = (uint)ids.Length; uint block = fetchBlock; ZIMapCommand.Fetch.Item[] part = null; MailInfo[] rval = null; if(count <= block) { fetch.Queue(ids, what); progress.Update(20); part = fetch.Items; if(part == null) { MonitorError("MailHeaders: FETCH failed: " + fetch.Result.Message); factory.DisposeCommands(null, false); return null; } rval = new MailInfo[part.Length]; for(uint irun=0; irun < part.Length; irun++) rval[irun] = new MailInfo(part[irun]); } else { List<MailInfo> items = new List<MailInfo>(); uint last = 0; uint offs = 0; uint[] sub = null; while(count > 0) { uint chunk = Math.Min(count, block); if(chunk != last) { sub = new uint[chunk]; last = chunk; } Array.Copy(ids, offs, sub, 0, chunk); progress.Update(offs, (uint)ids.Length); fetch.Queue(sub, what); part = fetch.Items; if(part == null) { MonitorError("MailHeaders: FETCH failed: " + fetch.Result.Message); factory.DisposeCommands(null, false); return null; } foreach(ZIMapCommand.Fetch.Item item in part) items.Add(new MailInfo(item)); fetch.Reset(); count -= chunk; offs += chunk; } rval = items.ToArray(); } factory.DisposeCommands(null, false); if(rval == null) rval = new MailInfo[0]; MonitorInfo("MailHeaders: Got " + rval.Length + " mails"); progress.Done(); return rval; }
void Query(int offset) { try { int serverId = ServerDropDownList.SelectedServerId; GameServer server = ServerDropDownList.SelectedGameServer; if (server == null) { LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer); return; } if (!server.IsConnected) { LabelOpMsg.Text = StringDef.NoConnectionAlert; return; } ArrayList paramList = new ArrayList(); StringBuilder searchCondition = new StringBuilder(); //searchCondition.Append(string.Format(" AND {0}>='{1}' AND {0} <'{2}'", FS2TableString.LogFieldLogTime, StartDate.SelectedDate, EndDate.SelectedDate.AddDays(-1))); if (StartDate.Selected) { searchCondition.Append(string.Format(" AND {0}>='{1}'", FS2TableString.MailFieldPostTime, StartDate.SelectedDate)); } if (EndDate.Selected) { searchCondition.Append(string.Format(" AND {0}<'{1}'", FS2TableString.MailFieldPostTime, EndDate.SelectedDate)); } string sender = TextBoxSender.Text; WebUtil.ValidateValueString(sender); if (sender.Length > 0) { if (CheckBoxSender.Checked) { searchCondition.Append(string.Format(" AND {0}='?'", FS2TableString.MailFieldSender)); paramList.Add(sender); } else { searchCondition.Append(string.Format(" AND {0} LIKE '%?%'", FS2TableString.MailFieldSender)); paramList.Add(sender); } } string receiver = TextBoxReceiver.Text; WebUtil.ValidateValueString(receiver); if (receiver.Length > 0) { if (CheckBoxReceiver.Checked) { searchCondition.Append(string.Format(" AND {0}='?'", FS2TableString.MailFieldReceiver)); paramList.Add(receiver); } else { searchCondition.Append(string.Format(" AND {0} LIKE '%?%'", FS2TableString.MailFieldReceiver)); paramList.Add(receiver); } } string filterNegative = TextBoxFilter.Text.Trim(); if (filterNegative != null && filterNegative.Length != 0) { if (CheckBoxFilter.Checked) { searchCondition.Append(string.Format(" AND {0}!='?'", FS2TableString.MailFieldSender)); paramList.Add(filterNegative); } else { searchCondition.Append(string.Format(" AND {0} NOT LIKE '%?%'", FS2TableString.MailFieldSender)); paramList.Add(filterNegative); } } string filterNegative1 = TextBoxFilter1.Text.Trim(); if (filterNegative1 != null && filterNegative1.Length != 0) { if (CheckBoxFilter1.Checked) { searchCondition.Append(string.Format(" AND {0}!='?'", FS2TableString.MailFieldSender)); paramList.Add(filterNegative1); } else { searchCondition.Append(string.Format(" AND {0} NOT LIKE '%?%'", FS2TableString.MailFieldSender)); paramList.Add(filterNegative1); } } string orderByType = string.Empty; switch (ListBoxOrderByType.SelectedIndex) { case 0: orderByType = "ASC"; break; case 1: orderByType = "DESC"; break; } string orderByStatement = string.Empty; switch (ListBoxOrderBy.SelectedIndex) { case 0: orderByStatement = string.Format(" ORDER BY {0} {1}", FS2TableString.MailFieldPostTime, orderByType); break; case 1: orderByStatement = string.Format(" ORDER BY {0} {1}", FS2TableString.MailFieldSender, orderByType); break; case 2: orderByStatement = string.Format(" ORDER BY {0} {1}", FS2TableString.MailFieldReceiver, orderByType); break; } if (searchCondition.Length != 0) { searchCondition.Remove(0, 4); searchCondition.Insert(0, "WHERE "); } int limitCount = _recordPerPage; string limitStatement = string.Format("LIMIT {0},{1}", offset, limitCount); string cmdString = "SELECT {0} FROM {1} {2} {3} {4}"; string cmdFieldString = string.Format("{0},{1},{2},{3}",FS2TableString.MailFieldSender,FS2TableString.MailFieldReceiver, FS2TableString.MailFieldPostTime,FS2TableString.MailFieldMailData); string cmdCountFieldString = "COUNT(*)"; SqlCommand cmd = new SqlCommand(string.Format(cmdString, cmdFieldString, FS2TableString.MailTableName, searchCondition.ToString(),orderByStatement, limitStatement), paramList.ToArray()); SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd); if (result != null && result.Success) { Session[WebConfig.SessionQueryLogOffset] = offset; result.SetFieldType(new SqlDataType[]{ SqlDataType.String, SqlDataType.String, SqlDataType.DateTime, SqlDataType.String }); object[] record = null; ArrayList infos = new ArrayList(); while ((record = result.ReadRecord()) != null) { MailInfo info = new MailInfo(); info.sender = record[0] as string; info.receiver = record[1] as string; info.postTime = (DateTime)record[2]; info.mailData = record[3] as string; infos.Add(info); } ButtonPreviousPage.Enabled = (offset > 0); ButtonFirstPage.Enabled = (offset > 0); ButtonNextPage.Enabled = (infos.Count >= limitCount); //单独查询总数,只有第一页显示 if (offset == 0) { SqlCommand cmdCount = new SqlCommand(string.Format(cmdString, cmdCountFieldString, FS2TableString.MailTableName, searchCondition.ToString(), string.Empty, string.Empty), paramList.ToArray()); if (!server.IsConnected) { LabelOpMsg.Text = StringDef.NoConnectionAlert; return; } SqlResult resultCount = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmdCount); if (resultCount.ResultState == SqlResult.State.Done && resultCount.Success) { resultCount.SetFieldType(new SqlDataType[]{ SqlDataType.Int32 }); object[] count = resultCount.ReadRecord(); TableRow rowHead = new TableRow(); TableCell cellHead = new TableCell(); cellHead.Font.Bold = true; cellHead.ColumnSpan = 4; cellHead.Text = StringDef.Total + StringDef.Colon + (int)count[0]; rowHead.Cells.Add(cellHead); TableSearchMailList.Rows.Add(rowHead); } } bool success = CreateSearchResultList((MailInfo[])infos.ToArray(typeof(MailInfo))); PanelResult.Visible = success; if (!success) { LabelOpMsg.Text = StringDef.NoMatchingRecord; } else { LabelResult.Text = string.Format(StringDef.LabelStatisticResult, server.Group.Name, server.Name, string.Empty, StringDef.Mail); } } else { if (result == null) LabelOpMsg.Text = StringDef.QueryTimeOut; else LabelOpMsg.Text = StringDef.OperationFail; } } catch (Exception ex) { LabelOpMsg.Text = ex.Message; PanelResult.Visible = false; } }
bool CreateSearchResultList(MailInfo[] infos) { if (infos != null) { foreach (MailInfo info in infos) { TableRow row = new TableRow(); TableCell cell = new TableCell(); cell.Text = info.sender; row.Cells.Add(cell); cell = new TableCell(); cell.Text = info.receiver; row.Cells.Add(cell); cell = new TableCell(); cell.Text = info.postTime.ToString(); row.Cells.Add(cell); cell = new TableCell(); if (info.mailData.Length >= 30) { cell.Text = info.mailData.Substring(0, 30) + "......"; cell.ToolTip = info.mailData; } else cell.Text = info.mailData.Length == 1 ? " " : info.mailData; row.Cells.Add(cell); TableSearchMailList.Rows.Add(row); } return true; } return false; }
protected virtual void Send(MailInfo mailInfo) { log.Info(string.Format(CultureInfo.InvariantCulture, "Sending message {0}", GetMessageDescription(mailInfo.MailMessage))); var client = new SmtpClient(mailInfo.SmtpHost); try { if (mailInfo.SmtpUserName != null) { client.Credentials = new NetworkCredential(mailInfo.SmtpUserName, mailInfo.SmtpPassword); } if (mailInfo.SmtpPort != null) { client.Port = mailInfo.SmtpPort.Value; } client.Send(mailInfo.MailMessage); } finally { // .NET 3.5 var disposable = client as IDisposable; if (disposable != null) { disposable.Dispose(); } } }
public MailInfo[] MailHeaders(uint firstIndex, uint lastIndex, string what) { if(what == null || what == "") what = "UID FLAGS RFC822.SIZE BODY.PEEK[HEADER]"; if(lastIndex < firstIndex) return null; if(factory == null) return null; ZIMapCommand.Fetch fetch = new ZIMapCommand.Fetch(factory); if(fetch == null) return null; progress.Update(0); uint count = lastIndex - firstIndex; uint block = fetchBlock; uint progrcnt = 0; uint progrmax = count; List<MailInfo> items = null; ZIMapCommand.Fetch.Item[] part = null; while(count > 0) { uint chunk = count; // Math.Min(count, block); // bug on mono? if(chunk > block) chunk = block; fetch.Reset(); fetch.Queue(firstIndex, firstIndex+chunk-1, what); // semi logarithmic progress ... if(lastIndex == uint.MaxValue) { if(progrcnt < 32*16) progrcnt += 64; else if(progrcnt < 64*16) progrcnt += 16; else if(progrcnt < 99) progrcnt += 1; progress.Update(progrcnt / 16); } // exact progress ... else { progrcnt += block; progress.Update(progrcnt, progrmax); } part = fetch.Items; if(part == null) { if(fetch.CheckSuccess()) break; // server said: OK no more data if(fetch.Result.State == ZIMapProtocol.ReceiveState.Error && items != null) break; // server said: BAD no more data if(fetch.Result.State == ZIMapProtocol.ReceiveState.Failure) break; // server said: No no matching data MonitorError("MailHeaders: FETCH failed: " + fetch.Result.Message); factory.DisposeCommands(null, false); return null; } // only one chunk, directly return the array if(count == chunk && items == null) break; // multiple chunks, store items in a list if(items == null) items = new List<MailInfo>(); foreach(ZIMapCommand.Fetch.Item item in part) items.Add(new MailInfo(item)); count -= chunk; firstIndex += chunk; } factory.DisposeCommands(null, false); MailInfo[] rval = null; if (items != null) rval = items.ToArray(); else if(part == null) rval = new MailInfo[0]; progress.Done(); MonitorInfo("MailHeaders: Got " + rval.Length + " mails"); return rval; }