public void UserActivatedTest()
        {
            // Arrange
            Gmail.DeleteUnread();
            ForgotPasswordDialog.HelpMe(Users.Activated);
            ForgotPasswordDialog.WaitForClose();
            Gmail.WaitLetter();
            Gmail.GetLetterLinks();

            Assert.AreEqual(Users.Activated.Email, Gmail.LetterLinks["User"].Text);
            Browser.Goto(Gmail.LetterLinks["Reset"].Href);

            // Act
            var updateDialog = Dialogs.Update;

            updateDialog.UpdatePassword(Users.Activated.Password, Users.Activated.Password);
            var alertText = Browser.GetAlertText();

            Browser.AcceptAlert();
            var signedInPage = Pages.Home;

            signedInPage.Open();

            // Assert
            updateDialog.WaitForClose();
            Assert.IsFalse(ForgotPasswordDialog.Root.Displayed);
            Assert.AreEqual("http://lobster.media/marketplace", Browser.GetDriver.Url);
            Assert.AreEqual("Your password has been updated and you are now signed in!", alertText);
            Assert.IsTrue(signedInPage.AboutButton.Displayed);
            Assert.IsTrue(signedInPage.MyProfile.Displayed);
        }
예제 #2
0
        public void Login(Gmail gmail)
        {
            try
            {
                Init();
                string loginUrl = "https://accounts.google.com";
                webDriver.Navigate().GoToUrl(loginUrl);

                // id tab
                var emailInput = GetElement(webDriver, By.Id("Email"), 2);
                emailInput.Clear();
                emailInput.SendKeys(gmail.ID);
                Thread.Sleep(500);
                var nextBtn = GetElement(webDriver, By.Id("next"), 1);
                nextBtn.Click();
                Thread.Sleep(1000);

                // pass tab
                var passInput = GetElement(webDriver, By.Id("Passwd"), 1);
                passInput.Clear();
                passInput.SendKeys(gmail.OldPass);
                Thread.Sleep(500);
                var signInBtn = GetElement(webDriver, By.Id("signIn"), 1);
                signInBtn.Click();
                Thread.Sleep(1000);
            }
            catch (Exception ex)
            {
                logger.ErrorFormat("ID: " + gmail.ID + ", {0}, stacktrace: {1}", ex.Message, ex.StackTrace);
            }
        }
예제 #3
0
        public void UserRegisteredResendTest()
        {
            // Arrange
            Gmail.DeleteUnread();

            // Act
            LogInDialog.Login(Users.Registered);
            LogInDialog.WaitElementToAppear(LogInDialog.ErrorMessage);
            LogInDialog.Resend();
            var resend = Dialogs.Resend;

            // Assert UI
            LogInDialog.WaitForClose();
            resend.WaitElementToAppear(resend.Root);
            Assert.IsFalse(LogInDialog.Root.Displayed);
            Assert.IsTrue(resend.Root.Displayed);
            Gmail.WaitLetter();
            var letter = Gmail.GetMessageBody();

            // Assert Gmail
            Assert.AreEqual(1, Gmail.GetUnreadMessagesCount());
            var email = Gmail.GetEmailFromLetter(letter);

            Assert.AreEqual(Users.Registered.Email, email.Text);
        }
        public void SendMail(string ToMail, int userid)
        {
            Gmail mail = new Gmail
            {
                To      = ToMail,
                From    = ConfigurationManager.AppSettings["SMTPFromMail"].ToString(),
                Subject = "Password Setting",
                Body    = ConfigurationManager.AppSettings["PasswordUpdateUrl"].ToString() + userid
            };
            MailMessage mm = new MailMessage(mail.From, mail.To);

            mm.Body       = mail.Body;
            mm.Subject    = mail.Subject;
            mm.IsBodyHtml = false;

            SmtpClient smtp = new SmtpClient();

            smtp.Host      = "smtp.gmail.com";
            smtp.Port      = 587;
            smtp.EnableSsl = true;

            NetworkCredential nc = new NetworkCredential(mail.From, ConfigurationManager.AppSettings["SMTPFromMailPWD"].ToString());

            smtp.UseDefaultCredentials = true;
            smtp.Credentials           = nc;
            smtp.Send(mm);
        }
예제 #5
0
        public bool TurnOnLessSecureApp(Gmail gmail)
        {
            try
            {
                // add recovery email;
                AddRecoveryEmail(gmail);

                string changePassUrl = "https://myaccount.google.com/security#signin";
                webDriver.Navigate().GoToUrl(changePassUrl);
                Thread.Sleep(2000);


                ////h5[contains(.,'Allow less secure apps: ON')]
                // var h5Tag = GetElement(webDriver, By.XPath("//h5[contains(.,'Allow less secure apps: ON')]"), 15);
                var h5Tag         = webDriver.FindElement(By.XPath("//h5[contains(.,'Cho phép ứng dụng kém an toàn')]"));
                var divRoot       = h5Tag.FindElement(By.XPath("../../../.."));
                var divToggle     = divRoot.FindElement(By.XPath("//div[@role='checkbox']"));
                var checkStateAtt = divToggle.GetAttribute("aria-checked");
                if (checkStateAtt == "false")
                {
                    DivClick(webDriver, divToggle, 3000);
                }
                Thread.Sleep(1500);
                return(true);
            }
            catch (Exception ex)
            {
                logger.ErrorFormat("ID: " + gmail.ID + ", {0}, stacktrace: {1}", ex.Message, ex.StackTrace);
            }
            return(false);
        }
예제 #6
0
 public void SetupTest()
 {
     github   = new Github();
     fb       = new Facebook();
     gmail    = new Gmail();
     packtpub = new Packtpub();
 }
예제 #7
0
        public GmailEditForm(GmailManagerControl parentCtrl, Gmail editGmail)
        {
            InitializeComponent();
            this.parentCtrl = parentCtrl;

            this.editGmail = editGmail;
        }
예제 #8
0
 public void ThenIAgreeThePrivacyAndTerms()
 {
     Debug.WriteLine("Step 3: Agree the Tearms and Condition");
     Gmail.ScrollDown();
     System.Threading.Thread.Sleep(1000);
     Gmail.ClickOnIagreeButton();
 }
예제 #9
0
 private void SpamGmail(Gmail gmail)
 {
     if (gmail.GotoSpamFolder())
     {
         //case 1 Read ana mark not spam
         if (read_not_spam_gmail.Checked)
         {
             while (gmail.ReadNotSpam())
             {
                 Application.DoEvents();
             }
         }
         //case 2 check and mark as not spam
         else if (check_not_spam_gmail.Checked)
         {
             while (gmail.CheckNotSpam())
             {
                 Application.DoEvents();
             }
         }
         //case 3 check all and  mark not spam
         else if (checkall_not_spam_gmail.Checked)
         {
             while (gmail.CheckAllNotSpam())
             {
                 Application.DoEvents();
             }
         }
     }
 }
예제 #10
0
        public Task Invoke()
        {
            if (isRunning)
            {
                return(Task.CompletedTask);
            }

            emailBody = new StringBuilder();
            isRunning = true;

            var dtFmt = string.Format("{0} {1}", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString());

            emailBody.AppendLine(string.Format("Start Price Download at {0}", dtFmt));

            try
            {
                this.DownloadPrices();
                this.updateSymbolsList();
            }
            catch (Exception ex)
            {
                isRunning = false;
                emailBody.AppendLine(string.Format("ERROR {0}", ex.Message));
                Console.WriteLine("ERROR " + emailBody.ToString());
                Gmail.Send(subject + " ERROR " + DateTime.Now, emailBody.ToString(), recipient);
                return(Task.FromException(ex));
            }
            emailBody.AppendLine(string.Format("End Price Download at {0}", dtFmt));
            emailBody.AppendLine("");

            isRunning = false;
            Gmail.Send(subject + " " + DateTime.Now, emailBody.ToString(), recipient);
            Console.WriteLine(emailBody.ToString());
            return(Task.CompletedTask);
        }
예제 #11
0
        public void AddRecoveryEmail(Gmail gmail)
        {
            string changePassUrl = "https://security.google.com/settings/security/signinoptions/rescueemail";

            webDriver.Navigate().GoToUrl(changePassUrl);
            Thread.Sleep(2000);

            var emailInput = webDriver.FindElement(By.XPath("//input"));
            var text       = emailInput.GetAttribute("value");

            if (string.IsNullOrEmpty(text))
            {
                emailInput.SendKeys(gmail.RecoveryEmail);
                Thread.Sleep(1000);

                var spanTag = webDriver.FindElement(By.XPath("//span[contains(., 'Xong')]"));
                spanTag.Click();
                Thread.Sleep(3000);

                //var divBtn = spanTag.FindElement(By.XPath("../"));
                //divBtn.Click();
                //Thread.Sleep(1000);
                //DivClick(webDriver, divBtn, 3000);
            }
        }
예제 #12
0
        static async Task doscrape()
        {
            string html    = "";
            var    browser = new Browser();
            var    page    = await browser.Open("https://www.youtube.com/watch?time_continue=4&v=AaLTdrdVcLE&feature=emb_logo"); // https://bnonews.com/index.php/2020/01/the-latest-coronavirus-cases/");

            html = page.Select("#mvp-content-main").Text();

            // The table below shows confirmed cases of coronavirus (2019-nCoV) in China and other countries. To see a distribution map and a timeline, scroll down.
            // <strong>There are currently 9,171 confirmed cases worldwide, including 213 fatalities.</strong>

            var innerHtml = page.Select("#mvp-content-main").Children()[1].InnerHTML;

            innerHtml = innerHtml.Replace("</strong>", "");
            var parts = innerHtml.Split(">");
            var txt   = parts[1];

            Console.WriteLine(txt);
            // { "*****@*****.**" },
            List <string> recipients = new List <string> {
                { "*****@*****.**" },
                { "*****@*****.**" }
            };

            Gmail.Send("Corona Virus Update!!", txt, recipients);
            // Gmail.Send(txt, "*****@*****.**");
        }
예제 #13
0
 private void ProcessChangePassword(Gmail gmail)
 {
     //DriverController.Instance.Login(gmail);
     //DriverController.Instance.ChangePassword(gmail);
     PhantomController.Instance.Login(gmail);
     PhantomController.Instance.ChangePassword(gmail);
 }
예제 #14
0
        public ActionResult Index(Gmail aGmail)
        {
            string message = String.Empty;

            try
            {
                MailMessage aMailMessage = new MailMessage("*****@*****.**", aGmail.To);
                aMailMessage.Subject    = aGmail.Subjects;
                aMailMessage.Body       = aGmail.Body;
                aMailMessage.IsBodyHtml = false;


                SmtpClient aClient = new SmtpClient();
                aClient.Host      = "smtp.gmail.com";
                aClient.Port      = 587;
                aClient.EnableSsl = true;

                NetworkCredential aCredential = new NetworkCredential("*****@*****.**", "YourPassword");
                aClient.UseDefaultCredentials = true;
                aClient.Credentials           = aCredential;
                aClient.Send(aMailMessage);
                message = "Successfully sent email message to recipients...";
            }
            catch (Exception e)
            {
                message = e.Message;
            }
            ViewBag.Message = message;
            return(View());
        }
예제 #15
0
        /// <summary>
        /// Método encargado de obtener las propiedades necesarias para realizar
        /// la conexión con el tipo de Servidor necesario.
        /// </summary>
        /// <param name="envio">Se configura para enviar si es TRUE, para recibir si es FALSE</param>
        /// <param name="server">Servidor del cual se quiere obtener la configuración</param>
        /// <returns></returns>
        public Property obtenerPropiedades(bool envio, ServerDTO server)
        {
            Property propiedad = new Property();

            try
            {
                IServerProperty propiedadObtenida;

                switch (server.Name)
                {
                case "GMAIL":
                    propiedadObtenida = new Gmail();
                    if (envio)
                    {
                        propiedad = propiedadObtenida.getPropiedadEnviar(server);
                    }
                    else
                    {
                        propiedad = propiedadObtenida.getPropiedadRecibir(server);
                    }
                    break;

                case "OUTLOOK":
                    ///
                    break;

                case "YAHOO":
                    ///
                    break;
                }
            }
            catch (Exception ex) { }

            return(propiedad);
        }
예제 #16
0
 public ActionResult Contacts(EmailModel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var gmail = new Gmail
             {
                 Subject = string.Format("Sveitainė: Žinutė gauta nuo: {0}, telefonas: {1};", model.Name, model.Phone),
                 Message = model.Message
             };
             gmail.Send();
             Success("Jūsų žinutė išsiųsta.", true);
         }
         else
         {
             Error("Duomenys įvesti neteisingai, prašome teisingai užpildyti duomenų formą.", true);
         }
     }
     catch (Exception)
     {
         Error("Sisteminė klaida!", true);
     }
     return(View());
 }
예제 #17
0
        public IActionResult Index(Gmail em)
        {
            string to      = em.To;
            string subject = em.Subject;
            string body    = em.Body;

            MailMessage mm = new MailMessage();

            mm.To.Add(to);
            mm.Subject = subject;
            mm.Body    = body;

            //I want to send email from this adress
            mm.From       = new MailAddress("*****@*****.**");
            mm.IsBodyHtml = false;

            //Smtp client
            SmtpClient smtp = new SmtpClient("smtp.gmail.com");

            smtp.Port = 587;
            smtp.UseDefaultCredentials = true;
            smtp.EnableSsl             = true;

            smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "Ugesh2285!");

            //sent mail with mm object
            smtp.Send(mm);

            ViewBag.msg = "The Mail has been sent to " + em.To + "Successfully...!";

            return(View());
        }
예제 #18
0
        private void RespaldarAlCorreoLaBD()
        {
            String nombreArchivo = "CuentasPagar_" + Herramientas.Conversiones.Formatos.DateTimeAFechaLOGArchivo(DateTime.Now) + ".db";

            Herramientas.Archivos.Archivo.CopiarArchivo(Environment.CurrentDirectory + "\\CuentasPagar.db", Environment.CurrentDirectory + "\\" + nombreArchivo);

            Adjunto adj = new Adjunto();

            adj.NombreArchivo = nombreArchivo;
            adj.Tipo          = Adjunto.TipoAdjunto.OTRO;
            adj.Stream        = Herramientas.Archivos.Archivo.CargarArchivoAMemoria(Environment.CurrentDirectory + "\\" + nombreArchivo);

            Gmail gmail = new Gmail();

            gmail.EmailUsar        = "*****@*****.**";
            gmail.ContrasenaUsar   = "cic.control.cuentas1";
            gmail.EmailDestino     = emails.Trim();
            gmail.ContenidoHTML    = @"<h1>Correo de respaldo de BD</h1>

<p>Este correo fue enviado por <strong>CIC</strong>, su objetivo es que tengas en tu correo un respaldo de tu BD de cuentas y en cualquier problema puedas recuperar tu informaci&oacute;n.</p>

<p>El archivo adjunto es la BD, para instalarla en el sistema solo debes quitar los n&uacute;meros hasta que su nombre sea &quot;<em>CuentasPagar.db</em>&quot;.</p>

<p>Cualquier problema responder a este correo.</p>

<p>Saludos!</p>";
            gmail.Asunto           = "Correo de respaldo CIC";
            gmail.NombreAMostrar   = "CIC - Control Inteligente de Cuentas";
            gmail.ArchivosAdjuntos = new List <Adjunto>();
            gmail.ArchivosAdjuntos.Add(adj);
            gmail.EnviarCorreo(Gmail.Prioridad.Normal);

            Herramientas.Archivos.Archivo.EliminarArchivo(Environment.CurrentDirectory + "\\" + nombreArchivo);
            Herramientas.Forms.Mensajes.Informacion("Email enviado correctamente.");
        }
        static void Main(string[] args)
        {
            PrintUnreadMessagesCount();

            Gmail.DeleteAllUnreadMessages();

            PrintUnreadMessagesCount();
        }
예제 #20
0
 public void WhenIEnterValidFirstLastNameAndInvalidEmailAddress()
 {
     Debug.WriteLine("Step 2: Enter valid first and last Name but invalid email");
     Gmail.TypeFirstName();
     Gmail.TypeLastName();
     Gmail.TypeInvalidGmailAddress();
     System.Threading.Thread.Sleep(1000);
 }
예제 #21
0
        public void UpdateGmailToList(Gmail gmail)
        {
            SaveData();

            this.Invoke(new Action(() => {
                gmailBlv.Refresh();
            }));
        }
예제 #22
0
 public void ThenIShoulClickOnSignOutButton()
 {
     Debug.WriteLine("Step 3: Log out from Gmail");
     Gmail.ClickOnGmailLogo();
     System.Threading.Thread.Sleep(1000);
     Gmail.ClickOnMyAccountLogo();
     Gmail.ClickOnSignOutButton();
     System.Threading.Thread.Sleep(2000);
 }
예제 #23
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                Gmail gmail = new Gmail
                {
                    Email         = _email,
                    Password      = StringUtil.EncryptString(_pass),
                    Note          = note,
                    IsUse         = true,
                    LastUsedTime  = DateTime.MinValue,
                    RecoveryEmail = _recoveryEmail
                };

                parentCtrl.AddGmailToList(gmail, result => {
                    if (!string.IsNullOrEmpty(result))
                    {
                        MessageBox.Show(result);
                    }
                    else
                    {
                        MessageBox.Show("Done!");
                    }
                });
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }



            // DriverController ctrl = new DriverController();
            //// ctrl.UpdateTextEvent += parentCtrl.UpdateText;
            // bool loginResult = ctrl.Start(_email, _pass);
            // if (loginResult)
            // {
            //     //Settings.Default.GMAIL = _email;
            //     //Settings.Default.PASSWORD = _pass;
            //     //Settings.Default.Save();
            //     Gmail gmail = new Gmail
            //     {
            //         Email = _email,
            //         Password = _pass,
            //         Note = note,
            //         IsUse = true,
            //     };
            //     parentCtrl.AddGmailToList(gmail);
            //     MessageBox.Show("Saved");
            // }
            // else
            // {
            //     MessageBox.Show("Save failed!");
            // }

            // ctrl.Dispose();
        }
예제 #24
0
        private void ActionGmail(string[] accountDetail)
        {
            Doorman.Wait();
            Gmail gmail;

            if (accountDetail.Length == 2)
            {
                gmail = new Gmail(accountDetail[0], accountDetail[1]);
            }
            else if (accountDetail.Length == 4)
            {
                gmail = new Gmail(accountDetail[0], accountDetail[1], accountDetail[2], accountDetail[3]);
            }
            else
            {
                Doorman.Release();
                return;
            }
            bool init = gmail.Init();

            if (!init)
            {
                Doorman.Release();
                return;
            }
            gmail.Connect();

            if (open.Checked)
            {
                while (!gmail.CheckIfClosed())
                {
                    Thread.Sleep(5000);
                }
                Doorman.Release();
                return;
            }

            if (gmail.CheckIfConnected())
            {
                gmail.OldGmail();
                //to spam action
                if (Check_gmail_spam_checked())
                {
                    SpamGmail(gmail);
                }

                //to inbox action()
                if (Check_yahoo_inbox_checked())
                {
                    InboxGmail(gmail);
                }

                gmail.Destroy();
            }
            Doorman.Release();
        }
예제 #25
0
 public void WhenILoginWithValidCredential()
 {
     Debug.WriteLine("Step 2: Login to Gmail");
     Gmail.EnterEmailOrPhone();
     Gmail.ClickNextButtonAfterEnterUserName();
     System.Threading.Thread.Sleep(1000);
     Gmail.EnterPassword();
     Gmail.ClickNextButtonAfterEnterPassword();
     System.Threading.Thread.Sleep(3000);
 }
예제 #26
0
        private void postSend_Click(object sender, System.EventArgs e)
        {
            string address = "";

            if (LearnByError.Common.Dialog.InputBox(LearnByError.Internazional.Resource.Inst.Get("r34"),
                                                    LearnByError.Internazional.Resource.Inst.Get("r37"),
                                                    ref address, LearnByError.Internazional.Resource.Inst.Get("r36")) == System.Windows.Forms.DialogResult.OK)
            {
                Gmail.Send(LearnByError.Internazional.Resource.Inst.Get("r35"), Console, address);
            }
        }
 private void HandleEmailMessage(EmailMessage emailMsg)
 {
     try
     {
         Gmail.Send(emailMsg);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
        private void email_Click(object sender, EventArgs e)
        {
            if (tbxIDSIM.Text.Equals(""))
            {
                MessageBox.Show("Hãy chọn hóa đơn để gửi Email", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                HoaDonTinhCuoc hdtc = db.HoaDonTinhCuoc.Find(tbxMaHDTC.Text);

                if (hdtc.ThanhToan == true)
                {
                    MessageBox.Show("Hóa đơn " + tbxMaHDTC.Text + " đã được thanh toán", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    string ToEmail = (from a in db.KhachHang
                                      from b in db.ThongTinSIM
                                      where a.MaKH == b.MaKH && b.IDSIM == tbxIDSIM.Text && a.Flag == true
                                      select a.Email).FirstOrDefault().ToString();

                    if (ToEmail.Equals(""))
                    {
                        MessageBox.Show("Chủ sỡ hữu " + tbxIDSIM.Text + " không cung cấp địa chỉ Email", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        Gmail model = new Gmail();

                        MailMessage mm = new MailMessage();
                        mm.From = new MailAddress(ConfigurationManager.AppSettings["FromEmailAddress"].ToString());

                        mm.To.Add(new MailAddress(ToEmail));

                        mm.Subject = "Hóa đơn tiền điện thoại tháng " + Convert.ToDateTime(tbxNgayLapHD.Text).Month;
                        mm.Body    = "Chi tiết hóa đơn của " + tbxIDSIM.Text + ":\nPhí thuê bao: " + tbxPhiThueBao.Text + "\nTổng tiền: " + tbxTongTien.Text +
                                     "\nVui lòng đến đại lý để thanh toán!";
                        mm.IsBodyHtml = false;

                        SmtpClient smtp = new SmtpClient();
                        smtp.Host      = "smtp.gmail.com";
                        smtp.Port      = 587;
                        smtp.EnableSsl = true;

                        NetworkCredential nc = new NetworkCredential(ConfigurationManager.AppSettings["FromEmailAddress"].ToString(), ConfigurationManager.AppSettings["FromEmailPassword"].ToString());
                        smtp.UseDefaultCredentials = true;
                        smtp.Credentials           = nc;
                        smtp.Send(mm);

                        MessageBox.Show("Đã gửi Email hóa đơn tháng " + Convert.ToDateTime(tbxNgayLapHD.Text).Month + " đến cho " + tbxIDSIM.Text + "\nĐịa chỉ Email: " + ToEmail, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                }
            }
        }
예제 #29
0
 public TwitPicManager(
     Gmail gmail,
     IFileManager fileManager,
     IOptionsMonitor <EmailOptions> emailOptionsMonitor,
     IOptionsMonitor <GmailOptions> gmailOptionsMonitor)
 {
     this.gmail       = gmail;
     this.fileManager = fileManager;
     emailOptions     = emailOptionsMonitor.CurrentValue;
     gmailOptions     = gmailOptionsMonitor.CurrentValue;
 }
        private static void PrintUnreadMessagesCount()
        {
            System.Console.WriteLine(Gmail.GetUnreadMessagesCount());

            foreach (var scope in Preparation.Scopes)
            {
                System.Console.WriteLine(scope);
            }

            System.Console.ReadLine();
        }