Пример #1
0
        public MainForm()
        {
            InitializeComponent();

            this.Icon = global::MMail.Win.Properties.Resources.mms;
            this.notifyIcon1.Icon = global::MMail.Win.Properties.Resources.email_send;

            this._stop = true;
            this._isLog = false;
            this._notes = true;

            this._sendFail = 0;
            this._sendOk = 0;
            this._total = 0;
            this._current = 0;

            this._config = new MNConfig();

            this.xresvr = new MXResolver();
            this.xresvr.CacheEnable = true;

            this.files = new List<string>();
            this.domains = new Dictionary<string, int>();

            this.mdeliver = new MNDeliver();

            this.mdeliver.OnStart += createJob;
            this.mdeliver.OnLog += onLog;
            this.mdeliver.OnRun += Run;
        }
Пример #2
0
        private void setConfig(MNConfig cfg)
        {
            cfg.Body = this.txtContent.Text.Trim();
            cfg.FromAddr = this.tb_From.Text.Trim();
            cfg.FromName = this.tb_name.Text.Trim();
            cfg.Subject = this.tb_subject.Text.Trim();
            cfg.IsHTML = this.ddlFmt.SelectedIndex == 1;
            cfg.ThreadNum = Convert.ToInt32(this.numThread.Value);
            cfg.TimeOut = Convert.ToInt32(this.numTimeout.Value);
            cfg.AttemptNum = Convert.ToInt32(this.numAtt.Value);

            cfg.SMTP = this.tb_SmtpHost.Text.Trim();
            cfg.UseAuthenticate = this.chbSMTP.Checked;
            cfg.LoginID = this.tb_login.Text.Trim();
            cfg.Password = this.tb_pass.Text.Trim();

            cfg.TraceAddr = this.tb_tracefiled.Text.Trim();

            cfg.DNS.Clear();

            foreach (var s in this.txt_dns.Lines)
            {
                if (s.Length > 0)
                    cfg.DNS.Add(s.Trim());
            }
        }
Пример #3
0
        private void loadProfile(string filename)
        {
            List<MailRecipent> recipents;
            List<MNAttachment> attachments;
            MNConfig cfg;

            using (var db = OdbFactory.Open(filename))
            {
                var results = from r in db.AsQueryable<MailRecipent>()
                              orderby r.Index ascending
                              select r;

                recipents = results.ToList();

                var ms = from mat in db.AsQueryable<MNAttachment>()
                         orderby mat.FileName
                         select mat;

                attachments = ms.ToList();

                var ts = from mcfg in db.AsQueryable<MNConfig>()
                         select mcfg;

                cfg = ts.FirstOrDefault();
            }

            this.importList(recipents);
            this.importFiles(attachments);

            this.xresvr.Cache.Clear();

            if (cfg != null)
            {
                this.tb_From.Text = cfg.FromAddr;
                this.tb_name.Text = cfg.FromName;
                this.tb_subject.Text = cfg.Subject;
                this.txtContent.Text = cfg.Body;

                this.chbSMTP.Checked = cfg.UseAuthenticate;
                this.tb_login.Text = cfg.LoginID;
                this.tb_pass.Text = cfg.Password;
                this.tb_SmtpHost.Text = cfg.SMTP;

                if (cfg.IsHTML)
                    this.ddlFmt.SelectedIndex = 1;
                else
                    this.ddlFmt.SelectedIndex = 0;

                this.numThread.Value = cfg.ThreadNum;
                this.numTimeout.Value = cfg.TimeOut;
                this.numAtt.Value = cfg.AttemptNum;

                this._config = cfg;
                this._config.DNS = cfg.DNS;

                this.xresvr.ServerAddress.Clear();
                this.txt_dns.Clear();

                foreach (var ip in cfg.DNS)
                {
                    this.txt_dns.AppendText(ip.Trim() + "\r\n");

                    this.xresvr.ServerAddress.Add(new IPEndPoint(IPAddress.Parse(ip), 53));
                }                 
            }

            this.statusTotal.Text = "Total: " + recipents.Count.ToString();
        }