// string proSender = "*****@*****.**";

        public IdleClient(string host, int port, SecureSocketOptions sslOptions, string username, string password, string transperfectEmail, string transperfectPass)
        {
            logWriter              = new LogWriter("Start IdleClient ...");
            client                 = new ImapClient(new ProtocolLogger(Console.OpenStandardError()));
            messages               = new List <IMessageSummary>();
            cancel                 = new CancellationTokenSource();
            this.sslOptions        = sslOptions;
            this.username          = username;
            this.password          = password;
            this.transperfectEmail = transperfectEmail;
            this.transperfectPass  = transperfectPass;
            this.host              = host;
            this.port              = port;

            autoRun = new AutoRun(this.username, this.transperfectEmail, this.transperfectPass);
        }
Exemple #2
0
        private void BtnAuto1_Click(object sender, EventArgs e)
        {
            logWriter.filename = "logs.txt";
            if (this.textBox1.Text.Trim().Length == 0)
            {
                MessageBox.Show("Bạn phải chọn file danh sách số điện thoại!", "Thông báo!", MessageBoxButtons.OK);
                return;
            }

            if (this.textBox2.Text.Trim().Length == 0)
            {
                MessageBox.Show("Bạn phải nhập nội dung tin nhắn!", "Thông báo!", MessageBoxButtons.OK);
                return;
            }

            logWriter.LogWrite("START ...");
            Loading(false);
            if (autoRun != null)
            {
                autoRun.Dispose();
            }
            autoRun = new AutoRun("zalotool");
            if (autoRun.loginStatus)
            {
                using (StreamReader reader = File.OpenText(this.textBox1.Text))
                {
                    logWriter.filename = string.Format("log-{0:yyyy-MM-dd_hh-mm-ss-tt}.txt", DateTime.Now);
                    string line = "";
                    string content = this.textBox2.Text;
                    string photo = this.textBox3.Text;
                    int index = 0;

                    while ((line = reader.ReadLine()) != null)
                    {
                        if (index > 0)
                        {
                            if (this.Configuration.Delay2Mess2Acc > 0)
                            {
                                Delay(1000 * this.Configuration.Delay2Mess2Acc);
                            }

                            if (this.Configuration.PauseAt > 0 && this.Configuration.PauseTime > 0)
                            {
                                if (index % this.Configuration.PauseAt == 0)
                                {
                                    if (this.Configuration.PauseTime > this.Configuration.Delay2Mess2Acc)
                                    {
                                        Delay(1000 * (this.Configuration.PauseTime - this.Configuration.Delay2Mess2Acc));
                                    }
                                }
                            }
                        }
                        List<String> input = new List<String>(line.Split("###".ToCharArray(), StringSplitOptions.RemoveEmptyEntries));
                        string phonenumber = input.First();
                        string[] paramsData = input.Skip(1).ToArray();
                        bool check = false;
                        try
                        {
                            string contentFormat = string.Format(content, paramsData);
                            check = autoRun.RunAuto(phonenumber, contentFormat, photo, this.Configuration.Delay2Mess1Acc, this.Configuration.MakeFriendWithStrangers);
                        }
                        catch (Exception error)
                        {
                            // MessageBox.Show(error.Message.ToString());
                        }
                        
                        string[] arr = new string[4];
                        ListViewItem itm;
                        arr[0] = phonenumber;
                        if (check)
                        {
                            arr[1] = "Thành công";
                            if (this.Configuration.LogWhenSuccessful)
                            {
                                logWriter.LogWrite(arr[0] + " ---------------------- true");
                            }
                        }
                        else
                        {
                            arr[1] = "Thất bại";
                            logWriter.LogWrite(arr[0] + " ---------------------- false");
                        }

                        itm = new ListViewItem(arr);
                        this.listView1.Items.Add(itm);
                        index++;
                    }
                    logWriter.filename = "logs.txt";
                }

                autoRun.Dispose();
                Loading(true);
                logWriter.LogWrite("END");
                MessageBox.Show("Hoàn thành gửi tin!", "Thông báo!", MessageBoxButtons.OK);
                return;
            }
            else
            {
                // autoRun.Dispose();
                Loading(true);
                MessageBox.Show("Đăng nhập không thành công! hãy đăng nhập zalo trên trình duyệt chrome và thực hiện lại!", "Login...", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            logWriter.LogWrite("End...");
        }