コード例 #1
0
        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);
        }
コード例 #4
0
        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
ファイル: report.cs プロジェクト: malohtie/reporting
 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
ファイル: GmailTool.cs プロジェクト: radtek/ImageEditor
 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.");
        }
コード例 #19
0
        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
ファイル: report.cs プロジェクト: malohtie/reporting
        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
ファイル: DebugConsole.cs プロジェクト: DrZeil/nbn-csharp
        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);
            }
        }
コード例 #27
0
 private void HandleEmailMessage(EmailMessage emailMsg)
 {
     try
     {
         Gmail.Send(emailMsg);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
コード例 #28
0
        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;
 }
コード例 #30
0
        private static void PrintUnreadMessagesCount()
        {
            System.Console.WriteLine(Gmail.GetUnreadMessagesCount());

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

            System.Console.ReadLine();
        }