Exemplo n.º 1
0
        protected void BtnGenerate_Click(object sender, EventArgs e)
        {
            GVVerifyEmail.DataSource = null;
            GVVerifyEmail.DataBind();
            GVMailBoxer.DataSource = null;
            GVMailBoxer.DataBind();

            if (CheckBoxVE.Checked == true)
            {
                VerifyEmail(generateEmail(TbName.Text, TbSurname.Text, TbDomain.Text));
            }
            if (CheckBoxMB.Checked == true)
            {
                VerifyEmailMailBoxer(generateEmail(TbName.Text, TbSurname.Text, TbDomain.Text));
            }
        }
Exemplo n.º 2
0
        protected void VerifyEmailMailBoxer(List <string> emailsList)
        {
            Variable.variable = 0;

            string           accessKey = "59a37991b326fe7201f628ea15f0347d";
            string           apiUrl    = "https://apilayer.net/api/check?";
            List <MailBoxer> li        = new List <MailBoxer>();

            Variable.variable = 0;
            Variable.counter  = 0;

            var context = GlobalHost.ConnectionManager.GetHubContext <HitCounterHub>();

            WebClient webClient;

            try
            {
                using (webClient = new WebClient())
                {
                    foreach (string email in emailsList)
                    {
                        string  result  = webClient.DownloadString(string.Format("{0}access_key={1}&email={2}", apiUrl, accessKey, email));
                        JObject objJSON = default(JObject);
                        objJSON = JObject.Parse(result);

                        if (objJSON["smtp_check"] != null)
                        {
                            MailBoxer mb = new MailBoxer();

                            if (objJSON["email"] != null)
                            {
                                mb.email = (string.Format(objJSON["email"].ToString()));
                            }

                            if (objJSON["format_valid"] != null)
                            {
                                mb.isValid = (string.Format(objJSON["format_valid"].ToString())).ToUpper();
                            }

                            li.Add(mb);
                            Variable.variable += 7;
                            Variable.counter  += 1;

                            context.Clients.All.onHitRecorded2(Variable.counter, Variable.variable, mb.email, mb.isValid);
                        }
                        else
                        {
                            GVMailBoxer.DataSource = null;
                            GVMailBoxer.DataBind();
                            break;
                        }
                    }
                    GVMailBoxer.DataSource = li;
                    GVMailBoxer.DataBind();
                }
            }
            catch (Exception e)
            {
                LabelError.Text = e.Message.ToString();
            }
        }