예제 #1
0
 protected override void OnStart(string[] args)
 {
     MailerCenter.Start((msg) => {
         msg = "[{0}]-{1}".FormatWith(DateTime.Now.ToDateTimeFFF(), msg);
         Log.WriteLog(msg);
     });
 }
예제 #2
0
        public static void Resend(bool exit = false)
        {
            WriteLog("resend(rs) 重新发送邮件");
            WriteLog("===============================================================================");
            SendSettingHelper.Update(new SendSetting()
            {
                SettingID = 1, Status = 0
            });
            SendSettingHelper.ClearCacheSelectByID(1);

            new SQL()
            .Update(EmailList._)
            .Set(EmailList._LastSendStatus, 0)
            .Set(EmailList._LastSendError, "")
            .Set(EmailList._LastSendTime, null, true)
            .Set(EmailList._LastSendSmtp, "")
            .Set(EmailList._SendCount, 0)
            .ToExec();

            new SQL().Update(SmtpList._)
            .Set(SmtpList._Sends, 0)
            .Set(SmtpList._SendFails, 0)
            .ToExec();

            MailerCenter.Start((msg) => {
                msg = "[{0}]-{1}".FormatWith(DateTime.Now.ToDateTimeFFF(), msg);
                WriteLog(msg);
            }, () => { WriteLog("END"); if (exit)
                       {
                           System.Environment.Exit(0);
                       }
                       Console.Write("> "); });
            Parse(Console.ReadLine());
        }
예제 #3
0
 private void mnuAdd_Click(object sender, EventArgs e)
 {
     listBox1.Items.Add("");
     btnStart.Enabled = false;
     btnStop.Enabled  = true;
     MailerCenter.Start((msg) => {
         if (!listBox1.IsHandleCreated)
         {
             return;
         }
         listBox1.BeginInvoke(new Pub.Class.Action(() => {
             msg = "[{0}]-{1}".FormatWith(DateTime.Now.ToDateTimeFFF(), msg);
             Log.WriteLog(msg);
             if (listBox1.Items.Count > 10000)
             {
                 listBox1.Items.Clear();
             }
             listBox1.Items.Add(msg);
             listBox1.SelectedIndex = listBox1.Items.Count - 1;
         }));
     }, () => {
         this.BeginInvoke(new Pub.Class.Action(() => {
             btnStart.Enabled = true;
             btnStop.Enabled  = false;
         }));
     });
 }
예제 #4
0
 private void mnuDelete_Click(object sender, EventArgs e)
 {
     listBox1.Items.Add("正在停止发送.....");
     listBox1.SelectedIndex = listBox1.Items.Count - 1;
     MailerCenter.Stop();
     btnStart.Enabled = true;
     btnStop.Enabled  = false;
 }
예제 #5
0
 public static void Send(bool exit = false)
 {
     WriteLog("send(s) 发送邮件");
     WriteLog("===============================================================================");
     MailerCenter.Start((msg) => {
         msg = "[{0}]-{1}".FormatWith(DateTime.Now.ToDateTimeFFF(), msg);
         WriteLog(msg);
     }, () => { WriteLog("END"); if (exit)
                {
                    System.Environment.Exit(0);
                }
                Console.Write("> "); });
     Parse(Console.ReadLine());
 }
예제 #6
0
 protected override void OnStop()
 {
     MailerCenter.Stop();
 }
예제 #7
0
 private void frmSendEmail_FormClosed(object sender, FormClosedEventArgs e)
 {
     MailerCenter.Abort();
 }